Third Order Convergence for Reciprocal
|
09-19-2021, 04:47 PM
(This post was last modified: 09-19-2021 07:30 PM by Albert Chan.)
Post: #2
|
|||
|
|||
RE: Third Order Convergence for Reciprocal
Newton's or Halley's reciprocal iteration formula required a good guess.
Both diverges if guess is off by 100% or more, due to factor (1-n*x) To get a good guess, we decompose number to mantissa, exponents. With a small mantissa range, we can curve fit 1/y with a few points. If we give up accuracy at the edges, we get overall better estimate. Below curve fit 1/y with y = [0.5+ε, 0.75, 1.0-ε], where ε = 1/30 1/y ≈ (2.586*y-5.819)*y+4.243 // 0.5 ≤ y < 1, max_rel_err ≈ 1.0% Apply 3rd order correction 2 times, max_rel_err ≈ (0.01)^(3*3) = 1E-18, below machine epsilon. Code: function rcp(x, verbose) Guess max_rel_err at x = 1/2, 5/8, 7/8, and slightly below 1.0 lua> rcp(0.5, true) 1.9800000000000004 1.999998 2 lua> rcp(5/8, true) 1.6162812500000001 1.6000016858668447 1.6 lua> rcp(7/8, true) 1.1312812500000002 1.142855955231404 1.1428571428571428 lua> rcp(1-1e-16, true) 1.0100000000000002 1.0000010000000001 1.0000000000000002 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Third Order Convergence for Reciprocal - Albert Chan - 09-19-2021, 04:14 PM
RE: Third Order Convergence for Reciprocal - Albert Chan - 09-19-2021 04:47 PM
RE: Third Order Convergence for Reciprocal - Albert Chan - 09-19-2021, 05:59 PM
RE: Third Order Convergence for Reciprocal - lyuka - 09-20-2021, 04:33 AM
RE: Third Order Convergence for Reciprocal - Albert Chan - 09-20-2021, 01:20 PM
RE: Third Order Convergence for Reciprocal - ttw - 09-20-2021, 10:14 AM
RE: Third Order Convergence for Reciprocal - Albert Chan - 09-22-2021, 10:32 AM
RE: Third Order Convergence for Reciprocal - Namir - 09-25-2021, 09:39 PM
|
User(s) browsing this thread: 2 Guest(s)