Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun poly [] x = 0.0
- | poly (hd::tl) x = hd + x*poly tl x;
- fun diff L = let fun mult n [] = []
- | mult n (hd::tl) = (n*hd)::mult (n+1.0) tl
- in tl (mult_elements 0.0 L) end;
- fun newton _ x0 0 = x0
- | newton L x0 i = let val x = newton L x0 (i-1)
- val f = poly L
- val f' = poly (diff L)
- in x - (f x)/(f' x) end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement