Post Reply 
New Ostrowski-Halley root seeking algorithm
01-15-2017, 05:15 PM
Post: #1
New Ostrowski-Halley root seeking algorithm
As I promised last week, here is my new algorithm that enhances Halley's method using an approach by Ostrowski (that he applied to Newton's method). To get the PDF file containing the report and the two Excel files containing the test functions click here and select the last item at the bottom to download the ZIP file associated with.

The pseudo code for the new algorithm 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)
  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.

The report on my website actually shows and explains two flavors for the algorithm. The test functions are applied to both flavors.

Enjoy

Namir
Find all posts by this user
Quote this message in a reply
01-16-2017, 09:12 PM (This post was last modified: 01-16-2017 09:12 PM by Namir.)
Post: #2
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




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