Nth root: Difference between revisions

9 bytes removed ,  4 years ago
m
Line 1,487:
<lang haskell>nthRoot :: Double -> Double -> Double
nthRoot n x =
in fst $
let pn = pred n
until
in fst $
(uncurry until(==))
(((,) <*> ((/ n) . ((+) . (pn *) <*> (x /) . (** pn)))) . snd)
(uncurry (==))
(x, x / n)
(((,) <*> ((/ n) . ((+) . (pn *) <*> (x /) . (** pn)))) . snd)
where
(x, x / n)
let pn = pred n
 
-------------------------- TESTS --------------------------
9,659

edits