MRaster examples 21.0.0.0
Image Processing Library
|
Draw Fractals via Newton-like methods. More...
Go to the source code of this file.
Draw Fractals via Newton-like methods.
Copyright (c) 1988-2015, 2017, Mitchell Jay Richling https://www.mitchr.me All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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:
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.