Generates a view on the Mandelbrot set
using an underlying C function.

mandelbrot(xlim = c(-2, 2), ylim = c(-2, 2), resolution = 600,
iterations = 50)
mandelbrot0(xlim = c(-2, 2), ylim = c(-2, 2), resolution = 600,
iterations = 50)

## Arguments

xlim |
limits of x axis (real part) |

ylim |
limits of y axis (imaginary part) |

resolution |
either an integer \(n\) for \(n^2\) pixels
or a list with x and y components specifying the resolution
in each direction (e.g. `list(x = 500, y = 500)` ) |

iterations |
maximum number of iterations to
evaluate each case |

## Value

a `mandelbrot`

structure with components: `x`

a vector
of the real parts of the x-axis; `y`

the imaginary parts of each
number (the y-axis); `z`

a matrix of the number of iterations that
\(|z|<2\)

## Details

`mandelbrot0`

is an experimental interface
for generating tidy data.frames faster than
`as.data.frame(mandelbrot())`

.

## Mandelbrot set

In brief, the Mandelbrot set contains the complex numbers
where the 0 orbit of the following function remains
bounded (\(<2\)):
$$f_{z+1} = z^2 + c$$

For information and discussion on the Mandelbrot and
related sets, one great resource is
plus.maths.org.
There's also a popular
YouTube video by Numberphile.

## Credits

Wraps original C code by Mario dos Reis, September 2003.

## References

https://stat.ethz.ch/pipermail/r-help/2003-October/039773.html
http://people.cryst.bbk.ac.uk/~fdosr01/Rfractals/index.html