title: cosine function calculating scheme
body: <p>Im making a scheme program that calculates
  cos(x) = 1-(x^2/2!)+(x^4/4!)-(x^6/6!).......</p>
  
  <p>whats the most efficient way to finish the program and how would you do the alternating addition and subtraction, thats what I used the modulo for but doesnt work for 0 and 1 (first 2 terms). x is the intial value of x and num is the number of terms</p>
  
  <pre><code>(define cosine-taylor
   (lambda (x num)
     (do ((i 0 (+ i 1)))
        ((= i num))
        (if(= 0 (modulo i 2))
            (+ x (/ (pow-tr2 x (* i 2)) (factorial (* 2 i))))
            (- x (/ (pow-tr2 x (* i 2)) (factorial (* 2 i))))
        ))
     x))
  </code></pre>