# Fractals/mandelbrot-graphics

Parts
* Library and c programs for CPU-based visualisation of the Mandelbrot set by Claude Heiland-Allen
* mandelbrot-prelude library for Haskell (low resolution image in terminal with block graphics characters)

# Install
## Dependencies

* pkg-config
* math
* gmp
* mpfr
* mpc
* pari
* ghci
* cairo ( and pixman )
* mandelbrot-numerics
* mandelbrot-symbolics
* openmp

### shared libraries
## git

and in the directory containing mandelbrot-graphics:
hen to run do:
check :
result :
or
check :
To set it permanently change file :
* .profile
* /etc/ld.so.conf.d/*.conf

# update
## git

From console opened in the mandelbrot-graphics directory :
If you made some local changes you can undu them :
then
Now install again

# recompile new version

bash script :

# names
## m

prefix m is from Mandelbrot

## r/d

prefix r or d in name describes precision
* d = double precision
* r = arbitrary precision
examples:

# How to use it ?
## prelude

Haskell program:
It gives :
* low resolution image in terminal with block graphics characters
* center, size and iteration number

## procedures in lib directory

* C source should *only* have #include <mandelbrot-numerics.h>
* compile and link with pkg-config: see mandelbrot-numerics/c/bin/Makefile for an example
* quickest way to get started is to just put your file in mandelbrot-numerics/c/bin and run make

### m_d_transform_rectangular

where :
* w = width in pixels
* h = height in pixels
* c = center of the image ( complex number )
* r = radius of the image ( double number

### m_d_interior

find points c of the Mandelbrot set, given a particular hyperbolic component and the desired internal angle. It involves Newton's method in two complex variables to solve
${\begin{cases}F^{p}(z,c)=z\\{\partial \over \partial z}F^{p}(z,c)=b\end{cases}}$
where
* $F^{0}(z,c)=z$
* $F^{q+1}(z,c)=F^{q}(F(z,c)^{2}+c)$
* p is the period of the target component
* $\theta$ the desired internal angle
* r is internal radius $r\leq 1$ . When r = 1.0 point is on the boundary. When r = 0 point is in the center of component ( = nucleus)
* $b=re^{2\pi i\theta }$ is a multiplier of point c
The hyperbolic component is described by
* period
* nucleus
Syntax
Input:
* z_guess
* c_guess ( usually nucleus of choosen hyperbolic component)
* interior ( multiplier)
* period
* maxstep
Output:
* c is the coordinates of the point ( c_out)
* z is periodic point ( z_out)
* result (m_newton) describes how Newton algorithm has ended : m_failed, m_stepped, m_converged. It is deined in ~/mandelbrot-numerics/c/include/mandelbrot-numerics.h
Examples of use:

## programs in bin directory

List :
result :

### m-warped-midgets

Result:

### Periodicity scan

Periodicity scan: labelling a picture of parameter plane with the periods of the Mandelbrot set components can provide insights into its deeper structure.
Plik : m-period.scan.c
Run console program
Example

### Moebius

Moebius transformation
* Code
* video
* description

### m-furcation-rainbow

Run:

### m-dense-misiurewicz

Program is based on m-render.c from mandelbrot-graphics.
It draws series of png images

### m-island-zoom

Makes 150 png images showing zoom to the 3 island ( biggest islands of the wake)
* one on the main antenna ( period 3) with center c = -1.754877666246693 +0.000000000000000 i in the 1/2 wake
* period 4 with center c = -0.156520166833755 +1.032247108922832 i , in 1/3 wake
* period 5 with addres 1-> 2-(1/3)-> 6 and center c = -1.256367930068181 +0.380320963472722 i

### cardioid warping

The exterior of the cardioid in the Mandelbrot set is warped to give the appearance of rotation.
The transformation is built up from smaller components, including:
* mapping of the cardioid to a circle
* Moebius transform of the circle to a straight line
* linear translation (which is animated)
* the inverses of the linear translation
* the inverse of Moebius transform of the circle to a straight line
These transformations and their derivatives (for distance estimator colouring) are described here: https://mathr.co.uk/blog/2013-12-16_stretching_cusps.html
The program to render the animation was implemented in C using the mandelbrot-graphics library found here: https://code.mathr.co.uk/mandelbrot-graphics The program is found in the repository as c/bin/m-cardioid/warping.c https://code.mathr.co.uk/mandelbrot-graphics/blob/60adc5ab8f14aab1be479469dfcf5ad3469feea0:/c/bin/m-cardioid-warping.c
What it the relation between x and internal angle ?

### m-stretching-cusps

One can add usage description :
example usage :
Input
* parent component
** re(nucleus)
** im(nucleus)
** period
* internal angles of 3 child components:
** t0
** t1
** tinfinity
Test result:
and image out.png
It uses:
* determinants (m_d_mat2 from mandelbrot-numerics library)) for computing the coefficients a,b,c,d of the Moebius transformation
* m_d_transform_moebius3 function for Moebius transformation defined by 3 points

### m-render

It is a base program for others.
This fragment of code describes how to use it :
Examples
The result is Mandelbrot set boundary using DEM

### m-streching-feigenbaum.c

* Feigenbaum stretch with external rays ( period doubling cascade)

### m-subwake-diagram-c
# See also

* Dictionary

# References

* ↑ mandelbrot-graphics - CPU-based visualisation of the Mandelbrot set by Claude Heiland-Allen
* ↑ stackoverflow question how-to-permanently-set-path-on-linux
* ↑ ubuntu environment Variables
* ↑ Interior coordinates in the Mandelbrot set by Claude Heiland-Allen
* ↑ periodicity scan by Claude Heiland-Allen
* ↑ fractalforums.org : tri-furcation-and-more
* ↑ Explicit determinant formula for Moebius transformation from wikipedia