Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Julia set
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Pseudocode for multi-Julia sets === : <math>f(z) = z^n + c</math> <syntaxhighlight lang="perl"> R = escape radius # choose R > 0 such that R**n - R >= sqrt(cx**2 + cy**2) for each pixel (x, y) on the screen, do: { zx = scaled x coordinate of pixel; # (scale to be between -R and R) zy = scaled y coordinate of pixel; # (scale to be between -R and R) iteration = 0; max_iteration = 1001; while (zx * zx + zy * zy < R**2 AND iteration < max_iteration) { xtmp = (zx * zx + zy * zy) ^ (n / 2) * cos(n * atan2(zy, zx)) + cx; zy = (zx * zx + zy * zy) ^ (n / 2) * sin(n * atan2(zy, zx)) + cy; zx = xtmp; iteration = iteration + 1; } if (iteration == max_iteration) return black; else return iteration; } </syntaxhighlight> Another recommended option is to reduce color banding between iterations by using a renormalization formula for the iteration. <ref name="Renormalizing the Mandelbrot Escape">{{cite web |last1=Vepstas |first1=Linas |title=Renormalizing the Mandelbrot Escape |url=https://linas.org/art-gallery/escape/escape.html |website=linas.org |publisher=Creative Commons |access-date=5 November 2023 |ref=ps1}} </ref> Such formula is given to be, :<math>mu = k + 1 - \frac{\log{\log{|z_{k}|}}}{\log{n}}</math> :<math>\forall f_{c,n}(z) = z^{n} + \text{lower power terms} + c</math> where <math>k</math> is the escaping iteration, bounded by some <math>K</math> such that <math>0 \leq k < K</math> and <math> K \in \mathbb{N}</math>, and <math>|z_{k}|</math> is the magnitude of the last iterate before escaping. This can be implemented, very simply, like so: <syntaxhighlight lang="perl"> # simply replace the last 4 lines of code from the last example with these lines of code: if(iteration == max_iteration) return black; else abs_z = zx * zx + zy * zy; return iteration + 1 - log(log(abs_z))/log(n); </syntaxhighlight> The difference is shown below with a Julia set defined as <math>f_{c, 2}(z)</math> where <math> c = -0.835 - 0.321i </math>. {{Gallery |title=Julia set with color banding and without |width=320|height=144 |align=center |File:JuliasetColorband.png |With color banding |alt1=Julia set with color banding |File:JuliasetNoColorband.png |Without color banding |alt2=Julia set without color banding }}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)