# Julia Sets Fractals

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## WHAT IS IT?

This displays the filled Julia Set for a chosen value of c = ax+bi. See Wikipedia,Julia Sets for explanation, including pseudocode for generating a Julia Set.

Displaying the fractal nature of Julia Set is an "old reliable" for any programming language. See rosettacode.com/JuliaSets for dozens of examples of code, each in a different language.

## HOW IT WORKS

This short program uses every patch within the grid set at 150*150 centred.
In order to make the numbers manageably small, every point in the "world" is scaled down to be a Z = x + yi complex number. Z is squared and c = ax+bi added to it in each iteration, ie Z' = Z^2 +c sends the original point into orbit around the "world", until it exceeds upper or lower limits, or stays bounded by the time of iter-max.

Each starting patch is plotted in green if it stays bounded within limits, otherwise black. displaying a filled Julia Set of green on black.

## HOW TO USE IT

Use sliders to load your selected complex number from those I recommend on the Interface. Having displayed a Julia Set, you may wish to vary the creal and cimag sliders to capture other Julia Sets and note the parameters of the interesting ones.

## THINGS TO NOTICE

The image quickly emerges point by point as "ask patches" proceeds, all within the first tick; the tick counter does not advance. "View updates" is set to continuous. The setting of iter-max below 15 may suggest a finite "coastline". It needs to be set far higher to suggest the necessary infinite fractal indentations.

## THINGS TO TRY

Increase scale to zoom in. The world dimensions may be varied, along with the scale slider, to optimise your display.

## EXTENDING THE MODEL

1) Colouring bands to show lengths of orbits. By counting the lengths of the orbits , one could colour the starting points in the x,y grid to show coloured bands for similar ranges of orbit lengths. This is the approach taken in the Mandelbrot.nlogo code in Models Library/Maths/Fractals. In fact, one can simply convert the Mandelbrot.nlogo model to display colour-banded Julia sets by switching a few lines of code in that model.(see below). 2)A slider could be developed to assist zooming to a selected area which is not central. 3)An animation might be developed showing how images vary as creal,cimag varies.

## NETLOGO FEATURES

1) Netlogo is well able to deal with varying c = ax+bi, as well as dimensions and scale, without any change to coding. A look at the rosettacode.com/JuliaSets examples reveals how much coding effort is required in other languages to fit the image into the display space available. Here a 150*150 display is chosen (with no wraparound) to give a sufficiently sharp display with a timely response. These dimensions may be varied to suit.

## RELATED MODELS

Mandelbrot.nlogo in Models Library/Maths/Fractals is relevant, especially if one wishes to see coloured bands to show how fast the orbits 1)blow up or 2)collapse beyond limits or 3)converge to a fixed point within bounds or 4)do not converge but stay within bounds. Mandelbrot.nlogo keeps Z constant at (0,0i), with c taking on the value a+bi for each patch. The patch's orbit is driven by Z(new) = Z^2 + c at each iteration.

Julia in contrast keeps c constant, with z taking on the value x+yi for each patch. The patch's orbit is driven by Z(new) = Z^2 + c at each iteration. By amending the code in Setup in Mandelbrot.nlogo to effect these changes, one produces banded Julia Sets.

## CREDITS AND REFERENCES

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.

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. Tag:fractals,applied math, dynamical systems & chaos

See Wikipedia/Julia Sets See rosettacode.com/JuliaSets

## Comments and Questions

;;Julia sets Based on WikiPedia/Julia set pseudocode. ;; Each starting patch is plotted in green if it stays bounded within limits, otherwise black. patches-own [ xplot yplot zreal zimag x y iter ] to setup clear-all ask patches [ set pcolor blue ] reset-ticks end to go ;; observer procedure: ask patches [ set iter 0 set x ( pxcor / scale ) set y ( pycor / scale ) while [ iter < iter-max and x ^ 2 + y ^ 2 < 4 ] [ set iter iter + 1 set zreal x * x - y * y + creal set zimag x * y * 2 + cimag set x zreal set y zimag ] if ( x ^ 2 + y ^ 2 > 4 ) or ( x ^ 2 + y ^ 2 < .00001 ) [ set pcolor black ] if iter = iter-max [ set pcolor green ] ] tick end

There is only one version of this model, created 4 months ago by Cormac Burke.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Julia Sets Fractals.png | preview | Preview for 'Julia Sets Fractals' | 4 months ago, by Cormac Burke | Download |

This model does not have any ancestors.

This model does not have any descendants.