Fractals/Computer graphic techniques/2D/exp

=Disambiguation= Exponential mapping of the plane is:
 * is exponential transformation of the plane

Exponential mapping of the plane  is not
 * the Julia set or Mandelbrot set of the exponential function ( exponentia map), like Exponential Mandelbrot z := exp(z) + c
 * Logarithmic scale on one axis
 * Logarithmic scale on both axes: Log-log scale plot
 * polar azimuthal equidistant projection ( Exponential map in Riemannian geometry)
 * The exponential operator, anamorphosis operator which can be applied to grayscale images.

Compare exponential function by different input
 * single number ( 0D space) gives natural exponent of the number
 * number line ( 1D space). Exponential scale is not used. Logarithmic scale is used for exponential data. It gives a linear function.
 * plane ( 2D space) gives exponential mapping

number
In mathematics, the logarithm is the inverse function to exponentiation. That means the logarithm of a number x to the base b is the exponent to which b must be raised, to produce x


 * $$y = \log_b x$$

is equivalent to


 * $$x=b^y$$

if $b$ is a positive real number. (If $b$ is not a positive real number, both exponentiation and logarithm can be defined but may take several values, which makes definitions much more complicated.)

The real exponential function is a bijection from $$\mathbb{R}$$ to $$(0;\infty)$$. Its inverse function is the natural logarithm, denoted $$\ln, \log, \log_e;$$ because of this, some old texts refer to the exponential function as the antilogarithm.

scale
A logarithmic scale (or log scale) is a way of displaying numerical data over a very wide range of values in a compact way—typically the largest numbers in the data are hundreds or even thousands of times larger than the smallest numbers. Such a scale is nonlinear: the numbers 10 and 20, and 60 and 70, are not the same distance apart on a log scale. Rather, the numbers 10 and 100, and 60 and 600 are equally spaced. Thus moving a unit of distance along the scale means the number has been multiplied by 10 (or some other fixed factor). Often exponential growth curves are displayed on a log scale, otherwise they would increase too quickly to fit within a small graph. Another way to think about it is that the number of digits of the data grows at a constant rate. For example, the numbers 10, 100, 1000, and 10000 are equally spaced on a log scale, because their numbers of digits is going up by 1 each time: 2, 3, 4, and 5 digits. In this way, adding two digits multiplies the quantity measured on the log scale by a factor of 100.

Logarithmic scale
 * on 1 axis = semi-log plot
 * linear-log plot
 * log-linear plot
 * on both axes = log-log plot

Logarithmic scale is used for exponential data. It gives a linear function.

mapping

 * GRAPHICS FOR COMPLEX ANALYSIS by Douglas N. Arnold:
 * "the complex exponential maps the infinite open strip bounded by the horizontal lines through +/- pi i one-to-one onto the plane minus the negative real axis.
 * The lines of constant real part are mapped to circles, and lines of constant imaginary part to rays from the origin.
 * In the animation we view a rectangle in the strip rather than the entire strip, so the region covered is an annulus minus the negative real axis.
 * The inner boundary of the annulus is so close to the origin as to be barely visible.
 * We also make the strip a bit thinner than 2 pi, so that the annulus does not quite close up."
 * the complex exponential map takes the rectangle |Re(z)| ≤ a, |Im(z)| ≤ π onto the annulus $$e^{-a} \le |w| \le e^a$$
 * Composition of complex Mappings Viewer by Paul Falstad - the composition of selected mapping functions:  g(f(z)). One have to increase grid size to have tha same effect ( rectangle to annulus mapping)
 * The Complex Exponential Function Author:Susan Addington
 * Complex mappings Author:Juan Carlos Ponce Campuzano
 * Complex exponential function Author:Tatsuyoshi Hamada : Complex exponential function maps rectangular domain to fan shaped image ( part or full sector of punctured circle )
 * Complex exponential map by Siamak on geogebra:
 * vertical axis is transformed to the circle on the w-plane
 * horizontal axis is is transformed to the radii on the w-plane
 * Images of a square grid of size [-3,3]x[-3,3] under the (conformal) exponential map givers almost full annulus
 * The complex exponential function mapping biholomorphically a rectangle [-1,1]x[0 ,pi/2] to a quarter-annulus $$[ e^{-1}, e]x[ e^{-1}, e]$$
 * 24 Views of the Complex Exponential Function by Pacific Tech
 * mathematica question: how-do-i-visualize-expz-as-a-complex-mapping


 * virtual math museum: ConformalMaps, complex exponential function:"a Cartesian Grid is mapped “conformally” (i.e., preserving angles) to a Polar Grid: the parallels to the real axis are mapped to radial lines, and segments of length 2π that are parallel to the imaginary axis are mapped to circles around 0."

exp(x + i · y) = exp(x) · exp(i · y) = exp(x) · cos(y) + i · exp(x) · sin(y)

period
The exponential function is periodic:

exp(z + 2 π * i) = exp(z). The periodicity is also clear from the formula:

exp(x + i * y) = exp(x) * (cos(y) + i * sin(y)).

The graph of the exponential function is a two-dimensional surface ( x,y) that curves through four dimensions ( x,y,v,w).

=Name=
 * exponential mapping
 * the exponential map
 * Mercator ( it is not good name because here is only mapping from flat complex plane ( 2D Cartesian plane) to exponential plane. Here there is no mapping from sphere to flat complex plane ( Cartesian plane) )
 * Mercator map
 * Mercator projection
 * polar projection
 * log-polar mapping ( Log-polar coordinates )
 * logarithmic
 * logarithmic projection around a point c0: z-> (log(|z-c0|)
 * log(z)-Mandelbrot-Zooms = side scrolling ( side scrolling fractal zoom )

General names:
 * graphical projection
 * geometric transformation

=Description=

Features
Maps
 * Rectangle of Cartesian plane to quadratic sectors of polar coordinate,
 * x is mapped to radius, and y to angle ( radians)


 * horizontal
 * maps $$c_0$$ to infinity ( limit of the sequence = MF = the Myrberg-Feigenbaum point = the Feigenbaum Point)
 * maps important components related with above sequence to the same size
 * vertical
 * vertical coordinate are periodic of period $$2\pi$$, because they use trigonometric functions

Examples:
 * sequence of root points for periods $$p = 1*2^n$$ ( period doubling cascade) and the limit point of the sequence  is the Myrberg-Feigenbaum point $$\mathbf{MF}_{1/2} = c_0 = -1.401155...$$
 * sequence of root points for periods $$p = 1*3^n$$ and the limit point of the sequence is the Myrberg-Feigenbaum point $$\mathbf{MF} = c_0 =  -1.7864402555636388747...$$

Informal description

 * The exponential mapping transforms the entire complex plane into a strip that has unlimited length along the real axis, and a width of 2π along the imaginary axis. Exponential Map from the Mandelbrot Set Glossary and Encyclopedia, by Robert Munafo, (c) 1987-2022
 * " The idea is to focus on a point in or near the Mandelbrot set, and create an image where one direction is the logarithm of the distance and the other one the angle. The result is very much like the astro-ph/031571 map and theXKCD cartoon versions. This map projection is conformal, so it does not distort local angles, and objects are usually recognizable on all scales." Anders Sandberg
 * Images of the Mandelbrot set with a logarithmic projection around a point c0: z-> (log(|z-c0|), arg(z-c0)). Anders Sandberg
 * "it is a log map toward the target point (or, as some might say, a Mercator projection with the target point as South pole and complex ∞ as North pole); horizontally it is periodic and I have placed two periods side to side, whereas vertically it extends to infinity at the top and at the bottom, which corresponds to zooming infinitely far out or in, at a factor of exp(2π)≈535.5 for every size of a horizontal period. Horizontal lines (“parallels”) on the log map correspond to concentric circles around the target point, and vertical lines to radii emanating from it; and the anamorphosis preserves angles." David Madore
 * "The coordinate system is such that the angular component goes to the y-axis, and the radius goes to the x-axis of the resulting image. In addition, the x-axis (radius) is normalized with exp-function so that angles are preserved in this mapping. " Mika Seppä
 * log : "To illustrate the complexity of the boundary of the Mandelbrot set, Figure 8 renders the image of dM under the transformation log(z - c) for a certain c in the boudary of Mandelbrot set. Note the cusp on the main cardioid in the upper right; looking to the left in the figure corresponds to zooming in towards the point c. (Namely, c = -0.39054087... - 0.58678790i... the point on the boundary of the main cardioid corresponding to the golden mean Siegel disk.). Note the cusp on the main cardioid in the upper right; looking to the left in the figure corresponds to zooming in towards the point c. "
 * "Legendary side scrolling fractal zoom. 1 Month + (Interpolator+Video Editor) = Log(z). This means logarithmic projection for this location, that gives this interesting side-scrolling plane ^^)﻿"
 * " There are no program that can render this fractal on log(Z) plane. But you can make it in Ultra Fractal or in similar software with programmable distributive. Formula is:C = exp(D), for D - is your zoomable coordinates﻿" SeryZone X
 * just c = c0 + cexp(x + i y) and x + i y = clog(c - c0), with scaling by 2pi/width (Claude)
 * idea
 * A Map of the Universe by J. Richard Gott III, Mario Jurić, David Schlegel, Fiona Hoyle, Michael Vogeley, Max Tegmark, Neta Bahcall, Jon Brinkmann
 * XKCD cartoon versions

Formal mathematical description
Forward transformation

Here transformation is a composition of 2 transformations:
 * complex exponential function: $$ f(c) = e^c $$
 * geometric or complex translation $$t(x) = x + c_0$$

$$ c_e = t(f(c)) $$


 * $$c_e \leftarrow e^c+c_0$$

where:
 * c is a parameter point from c plane ( flat image in Cartesian coordinate = linear scale on both axes). It is a a parameter of quadratic map $$z^2 + c $$
 * $$c_e$$ is a parameter in a new transformed plane ( log-polar image )
 * $$c_0$$ is a constant parameter (for translation). It is sometimes called center, but better name seems to be: target or limit point
 * e is Euler's number, is a mathematical constant approximately equal to 2.71828,

Inverse transformation:


 * $$ c = ln(c_e - c_0)$$

where:
 * $$ln$$ is natural logarithm

exp
Complex exponential map

The complex exponential function is periodic with period $log_{b}&thinsp;b = 1$ and $$\exp(z+2\pi i k)=\exp z$$ holds for all $$z \in \mathbb{C}, k \in \mathbb{Z}$$.

The exponential function maps any line in the complex plane to a logarithmic spiral in the complex plane with the center at the origin. Two special cases exist:
 * when the original line is parallel to the real axis, the resulting spiral never closes in on itself;
 * when the original line is parallel to the imaginary axis, the resulting spiral is a circle of some radius.

Considering the complex exponential function as a function involving four real variables: $$v + i w = \exp(x + i y)$$ the graph of the exponential function is a two-dimensional surface curving through four dimensions.

Starting with a color-coded portion of the $$xy$$ domain, the following are depictions of the graph as variously projected into two or three dimensions.

The second image shows how the domain complex plane is mapped into the range complex plane:
 * zero is mapped to 1
 * the real $$x$$ axis is mapped to the positive real $$v$$ axis
 * the imaginary $$y$$ axis is wrapped around the unit circle at a constant angular rate
 * values with negative real parts are mapped inside the unit circle
 * values with positive real parts are mapped outside of the unit circle
 * values with a constant real part are mapped to circles centered at zero
 * values with a constant imaginary part are mapped to rays extending from zero

The third and fourth images show how the graph in the second image extends into one of the other two dimensions not shown in the second image.

The third image shows the graph extended along the real $$x$$ axis. It shows the graph is a surface of revolution about the $$x$$ axis of the graph of the real exponential function, producing a horn or funnel shape.

The fourth image shows the graph extended along the imaginary $$y$$ axis. It shows that the graph's surface for positive and negative $$y$$ values doesn't really meet along the negative real $$v$$ axis, but instead forms a spiral surface about the $$y$$ axis. Because its $$y$$ values have been extended to $log_{b}&thinsp;1 = 0$, this image also better depicts the 2π periodicity in the imaginary $$y$$ value.

Log
Complex logarithm as a conformal map

Since a branch of $$\log z$$ is holomorphic, and since its derivative $$\log z$$ is never 0, it defines a conformal map.

For example, the principal branch $$w = \operatorname{Log} z$$, viewed as a mapping from $$\mathbb{C}-\mathbb{R}_{\le 0}$$ to the horizontal strip defined by $$\left| \operatorname{Im}z \right| < \pi$$, has the following properties, which are direct consequences of the formula in terms of polar form:
 * Circles in the z-plane centered at 0 are mapped to vertical segments in the w-plane connecting $$a - \pi i$$ to $$a + \pi i$$, where $$a$$ is the real log of the radius of the circle.
 * Rays emanating from 0 in the z-plane are mapped to horizontal lines in the w-plane.

Each circle and ray in the z-plane as above meet at a right angle. Their images under Log are a vertical segment and a horizontal line (respectively) in the w-plane, and these too meet at a right angle. This is an illustration of the conformal property of Log.



description for programmers
Filter Mercator from MathMap filter mercator (image in) in(xy*xy:[cos(pi/2/Y*y),1]) end

Maxima CAS src code:

(%i1) kill(all); (%i2) display2d:false; (%i3) ratprint : false; /* remove "rat :replaced " */ (%i4) c:cx +cy*%i$ (%i5) c0:c0x+c0y*%i$ (%i6) realpart(c0 + exp(c)); (%o6) %e^cx*cos(cy)+c0x (%i7) imagpart(c0 + exp(c)); (%o7) %e^cx*sin(cy)+c0y (%i8) cabs(c0 + exp(c)); (%o8) sqrt((%e^cx*sin(cy)+c0y)^2+(%e^cx*cos(cy)+c0x)^2) (%i9) carg(c0 + exp(c)); (%o9) atan2(%e^cx*sin(cy)+c0y,%e^cx*cos(cy)+c0x)

Notes
 * the mapping is periodic because there are trigonometric functions inside

(%i1) kill(all); (%i2) display2d:false; (%i3) ratprint : false; /* remove "rat :replaced " */ (%i4) ce:ceex+cey*%i; (%i5) c0:c0x+c0y*%i; (%i6) realpart(log(ce - c0)); (%o6) log((cey-c0y)^2+(ceex-c0x)^2)/2 (%i7) imagpart(log(ce - c0)); (%o7) atan2(cey-c0y,ceex-c0x)

center
$$c_0$$ is a constant parameter (for translation = offset).

It is sometimes called center, but better name seems to be:
 * target
 * limit point
 * offset or translation

The target point ( center) is projected onto -∞+0i in the exponential-mapped view. It would be intinitely far to the left and it is not seen on the image.

zoom

 * the leftmost column of the image has the minimal zoom ( the biggest plane radius )
 * the rightmost column of the image has the maximal zoom ( the smallet plane radius )

exponential grid scan
Conventions:
 * Robert Munafo generate the angle based on the horizontal pixel coordinate, and the radius from the vertical pixel coordinate ( image is in the vertical position, it is standing on the shorter dimension)
 * the normal way is to have the angle come from the vertical pixel coordinate ( image is in the horizontal position, it is lying on the longer dimension)

The grid scan with exponential coordiante mapping is different then the standard scan for flat images.

Description
 * image_width is the maximal number of pixels = width of the image in pixels ( integer number)

Here:
 * pixel coordinate j is going from 0 to image_height - 1
 * so j/pixel_height goes from 0.0 to 1.0
 * therfore angle goes from 0 to 2 pi

Claude's way is mathematically correct: the angle is usually thought of as going from -π to π, not from 0 to 2π. To fix this part, you can adjust your pixel coordinate right before computing an angle from it. Change this:

double e_angle = ((double) j) * px / r * 3.14159265359;

to this:

double e_angle = ((double) (j-h/2)) * px / r * 3.14159265359;

Notes
 * e_radius is a linear function of i
 * e_angle is a linear function of j

computing pixel coordinate
Here is example by by Robert Munafo

Compare with
 * exponential strip by Claude Heiland-Allen: The rendering of the final video can be accelerated by computing exponentially spaced rings around the zoom center, before reprojecting to a sequence of flat images. In case of problems : https://mathr.co.uk/mandelbrot/exponential_strip.svg

aspect ratio

 * For best (more conformal) results use a wide aspect ratio (9:1 works well, window size 1152x128 or 1536x170).

scale factor R
To minimize the total number of pixels that need calculating, which is proportional to

$$ K = \frac{R^2 - 1}{log R}$$

Define the efficiency of zoom by

$$\frac{2}{K}$$ then:
 * the traditional R=2 has an efficiency of only 46%,
 * R=4/3 has 74%
 * R=8/7 has 87% efficacy

where
 * video image size is W×H

=Videos=
 * Mercator - Scrolling Mandelbrot Fractal by Mathtown
 * Mappings by the exponential function by William Nesse
 * Mapping properties of the exponential function by MatheMagician
 * The function f(z)=exp(z) by Michael Robinson
 * Complex: visualizing exponential map and local inverse by James Cook
 * Mandelbrot Mercator Testing by Fractal MathPro

=Images=
 * Category:Mandelbrot sets - Mercator projection in commons

=How to read location from exponential image ?=
 * fractalforums.org : can-you-find-the-location-of-this-fractal ?
 * "An inverse mapping (using the complex logarithm function) is used to compute the location (in the strip) of needed data for any given location in the normal orthogonal coordinate space." Robert Munafo

Tips:
 * the image is not symmetric ( up and down) so imaginary part of c0 is not zero

=Implementations= Fractal programs
 * fraktaler-3
 * UltraFractal
 * Polar_Projection in fractalzoomer
 * Fractalshades - python program by Geoffroy Billotey
 * emndl: exponential strip visualisation of the Mandelbrot set, program by Claude Heiland-Allen
 * pfract - console c program by Mika Seppä
 * emndl: mathr's exponential strip mandelbrot set renderer: it is: c = c0 + cexp(x + i y) and x + i y = clog(c - c0), with scaling by 2pi/width
 * Fractalshades doc : P01-feigenbaum expmap

Kalles Fractaler and zoomasm
 * The rendering of the final video can be accelerated by computing exponentially spaced rings around the zoom center, before reprojecting to a sequence of flat images.
 * kf-2.15 supports rendering EXR keyframes in exponential map form
 * zoomasm can assemble above keyframes into a zoom video. zoomasm works from EXR, including raw iteration data, and colouring algorithms can be written in OpenGL shader source code fragments
 * kf-extras by Claude Heiland-Allen - has the exponential map (aka log polar or mercator projection) convertor

OpenCV
 * opencv 3.4 warpPolar function
 * logpolar transform using Camera by Aresh T. Saharkhiz
 * stackoverflow question: reprojecting-polar-to-cartesian-grid
 * descr
 * stackoverflow question: how-to-tune-log-polar-mapping-in-opencv
 * stackoverflow question : converting-an-image-from-cartesian-to-polar-limb-darkening

ImageMagic
 * pano2fisheye - Transforms a spherical panorama to a fisheye view = ? Reverse polar coordinates?
 * distorts depolar
 * snibgo's ImageMagick pages: Polar distortions

processing
 * forum.processing : how-to-change-an-image-from-x-y-coordinate-to-polar-coordinate

sci-kit
 * Using Polar and Log-Polar Transformations for Registration
 * skimage.transform : wrp_polar

Mathworks
 * Log-polar image sampling version 1.0.0.0 (4.33 KB) by David Young from mathworks

glsl
A typical shader looks like this ( code by Thorsten Förstemann):

Python

 * stackoverflow question: image-information-along-a-polar-coordinate-system

The images created in this way are also called:
 * Exponential Maps
 * Mercator-Mandelbrot Maps
 * Mercator projection of the Riemann number ball.



In the following program example, a logarithmic projection of the Mandelbrot set is calculated ,

The Mandelbrot set is calculated with NumPy using complex matrices. A logarithmic projection presented by David Madore and Anders Sandberg is used. This projection makes the calculation of zoom animations much easier

The logarithmic projection allows the creation of zoom animations of the Mandelbrot set to be extremely accelerated (see also the animation by Thorsten Förstemann and the coordinate analysis by Claude Heiland-Allen

When estimating the distance, the derivative $$dz_n = z_n\!'(c)$$ is also required.

The first polynomials are
 * $$z_0 = 0$$
 * $$z_1 = c$$
 * $$z_2 = c^2+c$$
 * $$z_3 = (c^2+c)^2+c$$,

the corresponding derivatives are
 * $$dz_0 = 0$$
 * $$dz_1 = 1$$
 * $$dz_2 = 2c+1$$
 * $$dz_3 = 2(c^2+c)(2c +1)+1$$.

All other polynomials and derivatives result from the iteration rule $$z_{k+1} = z_k^2+c$$ and the derivation rule.

To use the estimation formula


 * $$\delta_n = \log(|z_n|) \cdot |z_n| / |dz_n|$$

you can use the simplified sequences $$z_{k+1}=z_k^2+0$$ and $$dz_{k+1} = 2z_k dz_k+0$$ with the starting values can be considered.
 * $$z_0 = c$$
 * $$dz_0 = 1$$

The first polynomials are
 * $$z_0 = c$$
 * $$z_1 = c^2$$
 * $$z_2 = c^4$$
 * $$z_3 = c^8$$,

the corresponding derivatives are $$dz_0 = 1$$, $$ dz_1 = 2c$$, $$dz_2 = 4c^3$$ and $$dz_3 = 8c^7$$.

In general, this is how you get the polynomial $$z_n = c^{2^n}$$ and the derivative $$dz_n = 2^n c^{2^n-1}$$.

The associated Julia set is exactly the edge of the unit circle (cf. the Example on the dynamics of f(z) = z² in the article on Julia -Quantity, the short justification in van den Doel or the comprehensive analysis in Dang, Kauffman and Sandin).

The estimation formula results in


 * $$\delta_n = \log(|c|^{2^n}) \cdot |c|^{2^n} / (2^n |c|^{2^n -1}) = \ln(|c|) \cdot |c|$$

which is a good approximation for the distance to the unit circle when the point $$c$$ is close to the edge:
 * $$|c| = 1{,}1$$

gives
 * $$\delta_n = \ln(1{,}1) \cdot 1{,}1 \approx 0{,}1$$

and


 * $$|c | = 1{,}01$$ gives $$\delta_n = \ln(1{,}01) \cdot 1{,}01 \approx 0{,}01$$.

So if the real distance to the Mandelbrot set is $$\delta$$, the estimation formula gives the value


 * $$\delta_n = \log(|z_n|) \cdot |z_n| / |dz_n| \approx \ln(1+\delta) \cdot (1+\delta) \approx \delta$$.

However, it is not true that the limit $$\lim_{n \to \infty} \delta_n$$ converges to the real distance $$\delta$$; in fact, only weaker inequalities apply. You will often find a factor $$2$$ or $$0{.}5$$ in the estimation formula, depending on whether the distances are overestimated or underestimated.



=References=