Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sign :: Double -> Bool
  2. sign x = (x >= 0)  
  3.  
  4.  
  5. root :: (Double->Double)->Double->Double->Double->Double
  6. root func left right eps =
  7.     let temp = (left+right)/2
  8.     in
  9.     if (abs $ func $ temp) < eps
  10.         then temp
  11.         else
  12.             if sign (func temp) == sign (func left)
  13.                 then root func temp right eps
  14.                 else root func left temp eps
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement