Advertisement
Guest User

Untitled

a guest
Jan 29th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun​ poly [] x = 0.0
  2.   | poly (hd::tl) x = hd + x*poly tl x;
  3.  
  4. fun​ diff L = letfun​ mult n [] = []
  5.                    | mult n (hd::tl) = (n*hd)::mult (n+1.0) tl
  6.              intl (mult_elements 0.0 L) end;
  7.  
  8. fun​ newton _ x0 0 = x0
  9.   | newton L x0 i = letval​ x = newton L x0 (i-1)
  10.                         val​ f = poly L
  11.                         val​ f' = poly (diff L)
  12.                     in​ x - (f x)/(f' x) end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement