MRaster examples 21.0.0.0
Image Processing Library
Loading...
Searching...
No Matches
newton_vs.cpp File Reference

Draw Fractals via Newton-like methods. More...

Go to the source code of this file.

Detailed Description

Draw Fractals via Newton-like methods.

Author
Mitch Richling https://www.mitchr.me
Standards
C++20
Details

Laguerre's method:

\[x_k\]

\[G=\frac{f'(x_n)}{f(x_n)}\]

\[H=G^2-\frac{f''(x_n)}{f(x_n)}\]

\[a=\frac{n}{G+-\sqrt{(n-1)(nH-G^2)}}\]

\[x_{n+1}=x_n-a\]

f0v=f0(x)
if(abs(f0v)<eps) ERROR
f1v=f1(x)
f2v=f2(x)
G=f1v/f0v
G2=G*G
H=G2-f2v/f0v
sqr=(n-1)*(n*H-G2)
if(sqr<0) ERROR
sq=sqrt(sqr)
b1=G+sq
b2=G-sq
if(abs(b1)>abs(b2))
  b=b1
else
  b=b2
fi
if(abs(b)<eps) ERROR
a=n/b
x=x-a

Newton's

\[x=x-\frac{f(x_n)}{f'(x_n)}\]

f0v=f0(x)
f1v=f1(x)
if(abs(f1v)<eps) ERROR
x=x-f0v/f1v

Maxima:

f:sin(z);
z-f/diff(f, z);

Halley's

\[ x_n-\frac{f(x_n)}{f'(x_n)}\left[1-\frac{f(x_n)}{f'(x_n)}\cdot\frac{f''(x_n)}{2f'(x_n)}\right]^{-1} \]

f0v=f0(x)
f1v=f1(x)
if(abs(f1v)<eps) ERROR
f2v=f2(x)
G=f0v/f1v
b=1-G*f2v/f1v
if(abs(b)<eps) ERROR
a=G/b
xnext=x-a

Definition in file newton_vs.cpp.