G'day all.

Quoting Henning Thielemann <[EMAIL PROTECTED]>:

> http://darcs.haskell.org/htam/src/Numerics/ZeroFinder/Newton.hs
>
> with
>   inverse t (\x->(x^2,2*x)) t

The problem with all such solutions was touched on by Longesh:

> > > 20 iterations is a bit arbitrary.

This isn't a one-liner, but there's a straightforward answer to the
"arbitrary" number of iterations: Assuming that the task is to compute a
square root fast, a better solution is to come up with an initial
guess that's good enough such that you only need a fixed number of
iterations.

This one is as accurate as my CPU's built-in sqrt, and unlike every
other solution posted here, it uses no loops:

  http://www.opensubscriber.com/message/haskell-cafe@haskell.org/5135386.html

But, of course, we're now way off-topic from the original question!

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to