mandelbrot | R Documentation |
Calculate the Mandelbrot set
mandelbrot(x = c(-2, 1), y = c(-1.5, 1.5), nx = 600, ny = 600, iter = 50)
x |
x limits |
y |
y limits |
nx |
x resolution |
ny |
y resolution |
iter |
maximum number of iterations |
The set is obtained by iterating z_{j+1}=z_j^2+c
where
z
and c
are complex numbers. The initial value of z
,
z_0
is 0, and the value of c
is chosen arbitrarily.
It can be shown that if after a certain number of iterations, the modulus
of Z
is greater than 2, then the value of z
will head off to
infinity. The Mandelbrot set is defined as the set of points c
in the
complex plane for which the iteration procedure is bound (that is, for which
z
does not head off to infinity).
A list with components: x
, a vector of x
coordinates (real
part), y
, a vector of y
coordinates (imaginary part), and z
,
a nx
* ny
matrix with the number of interations i
used to
evaluate the complex point c = x + yi
.
z <- mandelbrot()
# The set is black
image(z, col=c(hcl.colors(n=100, pal="Lisbon"), "black"), las=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.