Name: Anonymous 2009-10-08 17:16
if you guys really think you are geniuses then write a java program that can approximate the sin function for any angle between 0 and 360 using taylor expansions
(defun factorial (x)
(reduce #'* (loop for i from 1 upto x collect i)))
(defun help (x)
(let (result
(n 0))
(lambda ()
(setq result
(* (/ (expt -1 n)
(factorial (1+ (* 2 n))))
(expt x (1+ (* 2 n)))))
(incf n)
result)))
(defun doit (x approximation)
(do* ((i 0 (1+ i))
(f (help x))
(y (funcall f)
(if (oddp i)
(- y (funcall f))
(+ y (funcall f)))))
((= i approximation) y)))