Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 6.74 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. [n207go@n207go ~]$ clisp
  2.   i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
  3.   I I I I I I I      8     8   8           8     8     o  8    8
  4.   I  \ `+' /  I      8         8           8     8        8    8
  5.    \  `-+-'  /       8         8           8      ooooo   8oooo
  6.     `-__|__-'        8         8           8           8  8
  7.         |            8     o   8           8     o     8  8
  8.   ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8
  9.  
  10. Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>
  11.  
  12. Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
  13. Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
  14. Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
  15. Copyright (c) Bruno Haible, Sam Steingold 1999-2000
  16. Copyright (c) Sam Steingold, Bruno Haible 2001-2010
  17.  
  18. Type :h and hit Enter for context help.
  19.  
  20. [1]> (defun start () ;defining domain and range
  21. (defparameter *fdomain-min* 1)
  22. (defparameter *fdomain-max* 5)
  23. (defparameter *frange-min* 2)
  24. (defparameter *frange-max* 6)
  25. (defparameter *gdomain-min* 2)
  26. (defparameter *gdomain-max* 8)
  27. (defparameter *grange-min* 0)
  28. (defparameter *grange-max* 3)
  29.  
  30. ;defining variables (will change)
  31. (defparameter *fx* 0)
  32. (defparameter *gx* 0)
  33. (defparameter *fog* 0)
  34. (defparameter *gof* 0)
  35. ;defining functions
  36. ;(defun fx ()
  37. ; (progn  (if (< *fx* 1) "none"
  38. ;           (if (> *fx* 5) "none"
  39. ;             (- 7 *fx*)))
  40. ;         (setf *fx* (+ *fx* 1))))
  41. ;(defun gx ()
  42. ; (progn (if (< *gx* 2) "none"
  43. ;        (if (> *gx* 8) "none"
  44. ;          (- (* 1/2 *gx*) 1)))
  45. ;        (setf *gx* (+ *gx* 1))))
  46. (defun fx-nosetf (x)
  47.   (if (< x 1) "none"
  48.       (if (> x 5) "none"
  49.           (- 7 x))))
  50. (defun gx-nosetf (x)
  51.   (if (< x 2) "none"
  52.       (if (> x 8) "none"
  53.           (- (* 1/2 x) 1))))
  54. (defun fog (x)
  55.  (if (or (equal (gx-nosetf x) "none") (equal (fx-nosetf (gx-nosetf x)) "none"))
  56. "none"                                                                        
  57.      (fx-nosetf (gx-nosetf x))))
  58. (defun gof (x)
  59.  (if (or (equal (fx-nosetf x) "none") (equal (fx-nosetf (fx-nosetf x)) "none"))
  60. "none"                                                                        
  61.      (gx-nosetf (fx-nosetf x))))
  62. ;(defun fog ()
  63. ;  (if (or (equal (fx-nosetf *fog*) "none") (equal (gx-nosetf *fog*) "none")) "n
  64. one"                                                                          
  65. ;    (progn
  66. ;      (fx-nosetf (gx-nosetf *fog*))
  67. ;      (setf *fog* (+ *fog* 1)))))
  68. ;(defun gof ()
  69. ;  (if (or (equal (fx-nosetf *gof*) "none") (equal (gx-nosetf *gof*) "none")) "n
  70. one"                                                                          
  71. ;    (progn
  72. ;      (gx-nosetf (fx-nosetf *gof*))
  73. ;      (setf *gof* (+ *gof* 1)))))
  74. ;defining table function
  75.  
  76. (defun table (x) (format t "~5t~a ~15t~a, ~25t~a ~35t~a, ~45t~a ~55t~a, ~65t~a ~
  77. 75t~a, ~85t~a, ~95t~a~%"                                                      
  78.                               "x" x "fx" (fx-nosetf x) "gx" (gx-nosetf x) "fog"
  79. (fog x) "gof" (gof x)))                                                        
  80. (table 0)
  81. (table 1)
  82. (table 2)
  83. (table 3)
  84. (table 4)
  85. (table 5)
  86. (table 6)
  87. (table 7)
  88. (table 8)
  89. (table 9)
  90. (table 10)
  91. ;now must answer questions
  92. (princ "#3 is included in table")
  93. (princ "#4 see table, notice when x= 6, 7, 8, that there is value for gx but not
  94.  for gof")                                                                    
  95. (princ "#5 plotted, lie on straight line, you can tell from table because the de
  96. crease is the same")                                                          
  97. (princ "#6 the domain of f o g is [4,8] and the range [1,3]")
  98. (princ "#7, the equations are f(x)=-x+7 and g(x)=1/2x-1")
  99. (princ "yes, table values match up, while boolean values limit domain/range appr
  100. opriately")                                                                    
  101. (princ "yes, the graphs are consistent")
  102. (princ "f(g(x)) would be -(1/2x-1)+7, so -1/2x+1+7, so -1/2+8")
  103. (princ "I learned a ton of stuff about lisp :D, but i also learned more about ho
  104. w to use my calculator, and about the domain and ranges of composition functions
  105. ")                                                                            
  106. )
  107. START
  108. [2]> (start)
  109.      x         0,        fx        none,     gx        none,     fog       none,
  110.      gof,      none                                                            
  111.      x         1,        fx        6,        gx        none,     fog       none,
  112.      gof,      none                                                            
  113.      x         2,        fx        5,        gx        0,        fog       none,
  114.      gof,      3/2                                                            
  115.      x         3,        fx        4,        gx        1/2,      fog       none,
  116.      gof,      1                                                              
  117.      x         4,        fx        3,        gx        1,        fog       6,  
  118.      gof,      1/2                                                            
  119.      x         5,        fx        2,        gx        3/2,      fog       11/2,
  120.      gof,      0                                                              
  121.      x         6,        fx        none,     gx        2,        fog       5,  
  122.      gof,      none                                                            
  123.      x         7,        fx        none,     gx        5/2,      fog       9/2,
  124.      gof,      none                                                            
  125.      x         8,        fx        none,     gx        3,        fog       4,  
  126.      gof,      none                                                            
  127.      x         9,        fx        none,     gx        none,     fog       none,
  128.      gof,      none                                                            
  129.      x         10,       fx        none,     gx        none,     fog       none,
  130.      gof,      none                                                            
  131. #3 is included in table#4 see table, notice when x= 6, 7, 8, that there is value
  132.  for gx but not for gof#5 plotted, lie on straight line, you can tell from table
  133.  because the decrease is the same#6 the domain of f o g is [4,8] and the range [
  134. 1,3]#7, the equations are f(x)=-x+7 and g(x)=1/2x-1yes, table values match up, w
  135. hile boolean values limit domain/range appropriatelyyes, the graphs are consiste
  136. ntf(g(x)) would be -(1/2x-1)+7, so -1/2x+1+7, so -1/2+8I learned a ton of stuff
  137. about lisp :D, but i also learned more about how to use my calculator, and about
  138.  the domain and ranges of composition functions                                
  139. "I learned a ton of stuff about lisp :D, but i also learned more about how to us
  140. e my calculator, and about the domain and ranges of composition functions"    
  141. [3]>