- (defun start () ;defining domain and range
- (defparameter *fdomain-min* 1)
- (defparameter *fdomain-max* 5)
- (defparameter *frange-min* 2)
- (defparameter *frange-max* 6)
- (defparameter *gdomain-min* 2)
- (defparameter *gdomain-max* 8)
- (defparameter *grange-min* 0)
- (defparameter *grange-max* 3)
- ;defining variables (will change)
- (defparameter *fx* 0)
- (defparameter *gx* 0)
- (defparameter *fog* 0)
- (defparameter *gof* 0)
- ;defining functions
- ;(defun fx ()
- ; (progn (if (< *fx* 1) "none"
- ; (if (> *fx* 5) "none"
- ; (- 7 *fx*)))
- ; (setf *fx* (+ *fx* 1))))
- ;(defun gx ()
- ; (progn (if (< *gx* 2) "none"
- ; (if (> *gx* 8) "none"
- ; (- (* 1/2 *gx*) 1)))
- ; (setf *gx* (+ *gx* 1))))
- (defun fx-nosetf (x)
- (if (< x 1) "none"
- (if (> x 5) "none"
- (- 7 x))))
- (defun gx-nosetf (x)
- (if (< x 2) "none"
- (if (> x 8) "none"
- (- (* 1/2 x) 1))))
- (defun fog (x)
- (if (or (equal (gx-nosetf x) "none") (equal (fx-nosetf (gx-nosetf x)) "none")) "none"
- (fx-nosetf (gx-nosetf x))))
- (defun gof (x)
- (if (or (equal (fx-nosetf x) "none") (equal (fx-nosetf (fx-nosetf x)) "none")) "none"
- (gx-nosetf (fx-nosetf x))))
- ;(defun fog ()
- ; (if (or (equal (fx-nosetf *fog*) "none") (equal (gx-nosetf *fog*) "none")) "none"
- ; (progn
- ; (fx-nosetf (gx-nosetf *fog*))
- ; (setf *fog* (+ *fog* 1)))))
- ;(defun gof ()
- ; (if (or (equal (fx-nosetf *gof*) "none") (equal (gx-nosetf *gof*) "none")) "none"
- ; (progn
- ; (gx-nosetf (fx-nosetf *gof*))
- ; (setf *gof* (+ *gof* 1)))))
- ;defining table function
- (defun table (x) (format t "~5t~a ~15t~a, ~25t~a ~35t~a, ~45t~a ~55t~a, ~65t~a ~75t~a, ~85t~a, ~95t~a~%"
- "x" x "fx" (fx-nosetf x) "gx" (gx-nosetf x) "fog" (fog x) "gof" (gof x)))
- (table 0)
- (table 1)
- (table 2)
- (table 3)
- (table 4)
- (table 5)
- (table 6)
- (table 7)
- (table 8)
- (table 9)
- (table 10)
- ;now must answer questions
- (princ "#3 is included in table")
- (princ "#4 see table, notice when x= 6, 7, 8, that there is value for gx but not for gof")
- (princ "#5 plotted, lie on straight line, you can tell from table because the decrease is the same")
- (princ "#6 the domain of f o g is [4,8] and the range [1,3]")
- (princ "#7, the equations are f(x)=-x+7 and g(x)=1/2x-1")
- (princ "yes, table values match up, while boolean values limit domain/range appropriately")
- (princ "yes, the graphs are consistent")
- (princ "f(g(x)) would be -(1/2x-1)+7, so -1/2x+1+7, so -1/2+8")
- (princ "I learned a ton of stuff about lisp :D, but i also learned more about how to use my calculator, and about the domain and ranges of composition functions")
- )