Nth root: Difference between revisions

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

edits