Guest User

Untitled

a guest
Dec 12th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.48 KB | None | 0 0
  1. (define (sinx x n)
  2.   (define (sinhulp counter resultaat teller noemer)
  3.     (if(< n counter) (exact->inexact resultaat)
  4.        
  5.        (let* ((nc (+ 1 counter))
  6.               (nt (* x (* x teller)))
  7.               (nn (* (+ counter (- counter 1)) (* counter noemer) ))
  8.               (no (if (= 0 (modulo counter 2))- +))
  9.               (nr (no resultaat (/ nt nn)))
  10.               )
  11.          (sinhulp nc nr nt nn))
  12.        ))
  13.   (trace sinhulp)
  14.   (sinhulp 2 x x 1)
  15.   )
  16.  
  17. (sinx 5 100)
Add Comment
Please, Sign In to add comment