Newton Roots Fractal
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model uses Newton's Method for finding the three complex roots of Z^3 = 1. The code selects each patch in the grid centred around the origin. By using Newton's Method, each patch is sent into orbit towards its unique complex root. Each patch is then coloured to show the root to which it is attracted. So all the patches together display the three coloured basins of attraction which lead to each of the three complex roots of 1. This model is not so much an endevour to find the three complex roots of Z^3 = 1 as to display the basins of attraction of those three complex roots.
The basins of attraction in the complex plane reveal a strange fractal pattern.
HOW IT WORKS
The colours of the display indicate the root to which each patch is attracted after some iterations of the map Z(new) = Z - ((Z^3 -1)/ 3Z^2).
Red regions are attracted to the root (1,0i).
Yellow regions are attracted to the root (-.5,0.8660254i).
Blue regions are attracted to the root (-.5, -0.8660254i).
Newton's Method converges on the root quickly so not many iterations are required. Here the formula for Newton's Method is: Z(n+1) = Z(n) -( Z^3 - 1)/3Z^2 . The code shows this being built step by step, with x and yi kept seperate to facilitate plotting.
HOW TO USE IT
Scale is for zooming. My default settings for a quick overview are: Scale at: 100, Settings: 150 * 150 centred, patch size 1 iter-max (in Code): 10
THINGS TO NOTICE
The strange fractal pattern can be explained by analogy: Three suspicious military powers divide up the world equally, centred around their home base at a complex root. However where a border would occur between two powers, the third power, unwilling to be excluded, insists on occupying the border region in order to seperate the other two. This in turn creates further borders between pairs of powers. The third power, unwilling to be excluded,insists on occupying the border region in order to seperate them. And so on, towards infinity.
THINGS TO TRY
1)The model could be simplified to display the basins of attraction of only one complex root by blanking ( ;; ) two of the three "set pcolor" lines at the end of the code. 2)To show the "border regions" feature at a very detailed level, reset (say): Scale at: 300, Settings: 950 * 270 centred, patch size 1 iter-max: 20 Switch to 3D view (in the Tools menu) and Zoom 3) Try iter-max: 3. This gives a neat display but no progression towards fractal infinity.
EXTENDING THE MODEL
The model could be extended with more coding to display the basins of attraction of the four complex roots of Z^4 = 1. A diagonal cross type display emerges, with shared border regions. ( The formule for Z^4 -1 =0 would use Z(n+1) = Z(n) -( Z^4 - 1)/4Z^3 ). The basic Real and Imaginary Arithmetic Operations are shown below the code to facilitate extensions to the model.
NETLOGO FEATURES
The patch (0,0i) must be excluded from the calculations as its inclusion would cause an error message. I exclude it by setting up a set consisting of all other patches, called "allBar00" and working with that.
RELATED MODELS
NetLogo "Mandelbrot" model, in model-library/maths/fractals My "Julia Sets Fractal" model in Netlogo Commons also deals with complex numbers.
CREDITS AND REFERENCES
Wikipedia : Newton Fractal illustrates many possibilities.
Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. The model was created in NetLogo 6.0.1, Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
Tag: Fractals, dynamical systems & chaos
Comments and Questions
;;Newton Roots Fractal 24 11 20 Based on WikiPedia/Newton Roots ;; Root1 is patch ( 1 * scale) ;; Root2 is patch ( -.5 * scale ) (.8660254 * scale ) ;; Root3 is patch ( -.5 * scale ) ( -.8660254 * scale ) globals [iter-max allBar00 r1 r2 r3 distToR1 distToR2 distToR3 minDist ] patches-own [ RealxSq ImySq Real3xSq Im3ySq RecipxDenom RecipImyDenom RealxCubedMOne ImyCubed xRealNew yImNew x y iter ] to setup clear-all set iter-max 10 set allBar00 patches with [ pxcor != 0 and pycor != 0 ] reset-ticks end to go ;; observer procedure: ask allBar00 [ set iter 0 ;; test on patch 2+i: xRealnew yImNew = 1.373 + .61333i) set x ( pxcor / scale ) ;; for test set scale to 1 set y ( pycor / scale ) ask patch (1 * scale) 0 [set pcolor white ] ;; Blank (;;) if zooming ask patch (-.5 * scale) ( 0.8660254 * scale) [set pcolor black ] ;; Blank (;;) if zooming ask patch (-.5 * scale) (-0.8660254 * scale) [set pcolor white ] ;; Blank (;;) if zooming ;; Calc Loops while [ iter < iter-max ] [ set iter iter + 1 set RealxSq ( x * x - y * y ) set ImySq (x * y + x * y ) set Real3xSq ( x * x - y * y ) * 3 set Im3ySq (x * y + x * y ) * 3 set RecipxDenom Real3xSq / ( Real3xSq ^ 2 + Im3ySq ^ 2) set RecipImyDenom ( - Im3ySq / ( Real3xSq ^ 2 + Im3ySq ^ 2) ) ;; - set RealxCubedMOne ( ( ( RealxSq * x ) - 1 ) - ImySq * y ) set ImyCubed ( RealxSq * y + x * ImySq ) set xRealnew x - ( RealxCubedMOne * RecipxDenom - ImyCubed * RecipImyDenom ) set yImNew y - ( RealxCubedMOne * RecipImyDenom + RecipxDenom * ImyCubed ) set x xRealnew set y yImNew ] ;;to find nearestRoot + color set distToR1 sqrt ( ( 1 - xRealnew ) ^ 2 + ( 0 - yImNew ) ^ 2 ) set distToR2 sqrt ( ( - .5 - xRealnew ) ^ 2 + ( 0.8660254 - yImNew ) ^ 2 ) set distToR3 sqrt ( ( - .5 - xRealnew ) ^ 2 + ( - 0.8660254 - yImNew ) ^ 2 ) set minDist min ( list distToR1 distToR2 distToR3 ) if minDist = distToR1 [ set pcolor red ] if minDist = distToR2 [ set pcolor yellow ] if minDist = distToR3 [ set pcolor blue ] ] tick end ; Real and Imaginary Arithmetic Operations ;From: NetLogo "Mandelbrot" model, see model-library/maths/fractals ; compute the real part of the product of 2 complex numbers ; = real1 * real2 - imaginary1 * imaginary2 ; compute the imaginary part of the product of 2 complex numbers ; = real1 * imaginary2 + real2 * imaginary1 ; compute the real part of the divisor of a complex numbers ie real part of reciprocal ; = real/(real^2 + Im^2) ; compute the imaginary part of the divisor of a complex numbers ie imaginary part of reciprocal ; = - imaginary/(real^2 + Im^2) ;For instance, to divide by 9+12i : multiply by real/mod - Im /mod = 9/225 -12/225 = .04 -.0531i ; compute the modulus of a complex number ; sqrt (real ^ 2 + imaginary ^ 2) ;Distance Formula in the Complex Plane ;The difference between the points (a, b) and (a1, b1) in the complex plane is d=Sqrt((a1−a)^2 +(b1−b)^2 ). ;Same formula as Euclidean distance.
There is only one version of this model, created over 4 years ago by Cormac Burke.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Newton Roots Fractal.png | preview | Preview for 'Newton Roots Fractal' | over 4 years ago, by Cormac Burke | Download |
This model does not have any ancestors.
This model does not have any descendants.