New Ostrowski-Halley root seeking algorithm
01-16-2017, 09:12 PM (This post was last modified: 01-16-2017 09:12 PM by Namir.)
Post: #2
 Namir Senior Member Posts: 813 Joined: Dec 2013
RE: New Ostrowski-Halley root seeking algorithm
I uploaded a new version of the algorithm that compromises between the two flavors of the algorithm I posted yesterday. You can upload the new ZIP file using the link in my first message.

The pseudo-code for the new version is:

Code:
Given the function f(x)=0, an initial guess, x, and a tolerance Toler for the guess: Do   h = 0.01 * (1 + |x|)   F0 = f(x)   Fp = f(x + h)   Fm = f(x - h)   Deriv1 = (Fp - Fm) / 2 / h   Deriv2 = (Fp - 2 * F0 + Fm) / h / h   Diff = F0 / Deriv1 / (1 - F0 * Deriv2 / Deriv1 / 2 / Deriv1)   z = x - Diff   Fz = f(z)   If |x - z| < h Then h = x -z   Deriv1b = (F0 - 2 * Fz) / (x - z)   Deriv2b = (Fp - 2 * Fz + Fm) / h / h   Diff2 = Fz / Deriv1b / (1 - Fz * Deriv2b / Deriv1b / 2 / Deriv1b)   x = z – Diff2 Loop Until |Diff2| < Toler  Return X as the refined guess for the root.
 « Next Oldest | Next Newest »

 Messages In This Thread New Ostrowski-Halley root seeking algorithm - Namir - 01-15-2017, 05:15 PM RE: New Ostrowski-Halley root seeking algorithm - Namir - 01-16-2017 09:12 PM

User(s) browsing this thread: 1 Guest(s)