 • May 18, 2021, 04:36:20 PM

### Author Topic:  Mandelbrot 2D projection using geometric algebra  (Read 812 times)

0 Members and 1 Guest are viewing this topic.

#### youhn ##### Mandelbrot 2D projection using geometric algebra
« on: January 13, 2021, 10:38:13 PM »
Been playing around with the mandelbrot formula, trying to work it out in geometric algebra:

$$x \rightarrow x^2 + c_0$$
$$x_0 = 0$$
$$c = a + be_{12} + ce_{23} + de_{31}$$

The $$e_{12}$$ is short for $$e_1e_2$$, which in the context of geometric algebra (clifford algebra) is the bivector formed by vectors $$e_1$$ and $$e_2$$. This should be (about?) the same as quaternions, but somewhat less complex. Based on the specific algebra rules, I think this works out to the following iteration calculation step:

$$a = a^2 - b^2 - c^2 - d^2 + a_0$$
$$b = 2\left(ab - cd\right) +b_0$$
$$c = 2\left(ac + bd\right) +c_0$$
$$d = 2\left(ad - bc\right) +d_0$$

Based a simple python code from https://rosettacode.org/wiki/Mandelbrot_set this seems to work, as it results in a nice mandelbrot set if plotted on (a, b) or even (a, c) or (a, d). The planes (b, c), (c, d) and (b, d) result in other shapes. In order:   Some questions I have due to my lack of math and programming skills:

Does this indeed give the same results as quaternions?
How this this look in 3D?

Some wobbly variation of parameters:

https://imgur.com/a/K0vrMcK

Python code:
Code: [Select]
import matplotlib.pyplot as pltimport math def linspace(start, stop, num):    return [start + (stop - start) / (num - 1) * k for k in range(num)] def zeros(rows, cols):    return [[0 for j in range(cols)] for i in range(rows)] d, n = 150, 120  # pixel density & number of iterationsr = 1 * 2 ** 2  # escape radius (must be greater than 2**2)x = linspace(-2.2, 1.0, 4 * d + 1)y = linspace(-1.2, 1.2, 3 * d + 1)T = zeros(len(y), len(x))var = linspace(0.0, 1*3.14159, 40) # parameter variation and no. of frames# time loopfor m, varc in enumerate(var):    # C in geometric algebra [scalar, e12, e23, e31]    a0 = 0.0    b0 = 0.0    c0 = 0.0    d0 = 0.0    b0 =  0.45*math.sin(varc)    c0 =  0.45*math.sin(varc*2)    # vector factor (should be 2 for the standard mandelbrot)    f = 2       # image loop    for i, d0 in enumerate(y):        for j, a0 in enumerate(x):            a = 0.0            b = 0.0            c = 0.0            d = 0.0            # iteration loop to check for escape or bound            for k in range(n):                aa = a ** 2                bb = b ** 2                cc = c ** 2                dd = d ** 2                if aa + bb + cc + dd > r:                    break                # set temp variables to prevent calcuation errors                ax = a                bx = b                cx = c                dx = d                a = aa - bb - cc - dd + a0                b = f * (ax*bx - cx*dx) + b0                c = f * (ax*cx + bx*dx) + c0                d = f * (ax*dx - bx*cx) + d0            T[i][j] = k + 1         filename = "mbga" + str(m).zfill(2) + ".png"    print(filename)    plt.imshow(T, cmap=plt.cm.twilight_shifted)    plt.axis('off')    plt.savefig(filename, dpi=230, bbox_inches="tight", pad_inches=0)

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #1 on: January 16, 2021, 12:33:19 PM »
Some first results for a julia set.

Still have some doubts if this is new, perhaps I posted in the wrong forum place. #### eiffie

• Fractal Friend
•  • Posts: 17 ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #2 on: February 05, 2021, 04:56:11 AM »
https://nylander.wordpress.com/category/fractals/hypercomplex/
This is a hypercomplex brot. There are a few formulas pictured here. Not exactly the same as yours but with a similar 3d look. A quaternion brot is just a Mandelbrot rotated around the x-axis.

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #3 on: February 13, 2021, 07:56:16 PM »
Thanks for the link, very similar formulas indeed.

I've managed to add the formula to a local copy of Mandelbulber 2. Here are some renders:

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #4 on: February 13, 2021, 07:57:48 PM »
and some more:

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #5 on: March 24, 2021, 10:36:04 PM »
With the same implementation in Mandelbulber (local copy) here's a short video clip of some 3D julia morphing:

Single raw render attached.

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #6 on: March 27, 2021, 09:14:50 AM »
Another short video result of this Mandelbrot implementation. Shows how the top half(ish) of the set (not the julia this time) morphs when changing w from 0.88 to -0.78. Formulas used in Mandelbulber:

Code: [Select]
x = x^2 - y^2 - z^2 - w^2y = 2 * (x*y - z*w)z = 2 * (x*z + y*w)w = 2 * (x*w - y*z)

Preview image attached.

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #7 on: May 03, 2021, 07:01:56 PM »
Geometric algebra uses unit elements like scalars, vectors, bivectors and trivectors.
These can be seen as points, lines, planes and volumes.
Planes and volumes have orientation, similar to a vector having a direction.
Bivectors are created from 2 vectors, the order of the "sweep" dictates the rotational direction (orientation).
Trivectors are created from a bivector and a perpendicular vector.

Using a combination of 4 unit elements give different results when deriving the iteration step of the mandelbrot set. The following strange short dance of the mset uses a slightly different set of elements than the previous posts in this topic.

Some examples of derivations will follow.
« Last Edit: May 03, 2021, 08:09:25 PM by youhn »

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #8 on: May 05, 2021, 09:44:00 PM »
Summary of notes, derivations and more.

The geometric product is written as normal multiplication. For example e1e2 means the geometric product between e1 and e2. Some rules for the algebra:

e1e1 = 1
e1e2 = -e2e1

From the above it follows:
(e1e2)^2 = -1

The elements e1 and e2 are the unit vectors. These two combined to e1e2 or short notation e12 give the bivector, which is an oriented area in the plane spawned by vectors e1 and e2.

For 3D space we can simply add e3. Now we can form the trivector e1e2e3, or short e123. This extra unit vector extrudes into a cube, or could be seen as a screw rotation (oriented 3D volume). If we square e123 :

e123^2 = (e1e2e3)(e1e2e3)
e123^2 = + e1e2e3e1e2e3
e123^2 = - e1e2e1e3e2e3
e123^2 = + e1e1e2e3e2e3
e123^2 = + ( 1 )e2e3e2e3
e123^2 = - e2e3e3e2
e123^2 = - e2( 1 )e2
e123^2 = - e2e2
e123^2 = - 1

So e123 also squares to -1 in 3D space (dual to quaternions).

Now we zoom into the iteration step of the Mandelbrot set, let's say x -> x^2 + c because we want to keep this real. No need for complex numbers, as they naturally arise from the geometric product applied to the unit elements. Different combination of unit elements can be chosen as the vector space for the mandelbrot calculation:

a + be12

This combination of scalar a and bivector b would give the same results as the normal mset in the complex plane. Though it can easily be extended into various 3D forms:

(a + be12 + ce23 + de31)^2 = a^2 - b^2 - c^2 - d^2 + 2abe12 + 2ace23 + 2ade31 + 2bce12e23 + 2bde12e31 + 2cde23e31

The last three terms can be rewritten to the unit bivectors:

(a + be12 + ce23 + de31)^2 = a^2 - b^2 - c^2 - d^2 + 2abe12 + 2ace23 + 2ade31 - 2bce31 + 2bde23 - 2cde12

= a^2 - b^2 - c^2 - d^2 + 2(ab - cd)e12 + 2(ac + bd)e23 + 2(ad - bc)e31

This has the following parts:

scalar = a^2 - b^2 - c^2 - d^2
bivector e12 = 2(ab - cd)
bivector e23 = 2(ac + bd)
bivector e31 = 2(ad - bc)

Other combinations with some images to follow.
« Last Edit: May 06, 2021, 12:13:09 AM by youhn »

#### youhn ##### Re: Mandelbrot 2D projection using geometric algebra
« Reply #9 on: May 12, 2021, 07:38:34 PM »
Let's use Geometric Algebra to derive the mandelbrot set with the following set of elements:

Scalar
Vector e1
Vector e2
Bivector e12

We take these values in a 4D vector space and use the same algebraic principles as above.

(a + be1 + ce2 + de12)^2 = a^2 + b^2 + c^2 - d^2 + 2(ab - cd)e1 + 2(ac + bd)e2 + 2(ad - bc)e12

Scalar = a^2 + b^2 + c^2 - d^2
Vector e1 = 2(ab - cd)
Vector e2 = 2(ac + bd)
Bivector e12 = 2(ad - bc)

Since e1 and e2 are both of the same type (vectors), the planes ab and ac will look the same. Similar for other combinations. This results in 4 unique planes. Attached is an example animated gif that rotates from plane ab to ad.

Result looks similar to some examples in the following topics:
https://fractalforums.org/fractal-mathematics-and-new-theories/28/split-complexminkovski-space-fractal/3989
https://fractalforums.org/programming/11/juliter-transformation/4148/msg28052#msg28052

### Similar Topics ###### Mandelbrot set interior description with simple geometric objects

Started by marcm200 on Fractal Mathematics And New Theories

5 Replies
646 Views March 19, 2020, 07:47:52 AM
by marcm200 ###### perturbation algebra

Started by claude on Fractal Mathematics And New Theories

2 Replies
612 Views May 20, 2019, 06:45:21 AM
by LionHeart ###### basic algebra problem

Started by woodymnt on Noob's Corner

2 Replies
220 Views March 30, 2020, 08:58:53 PM ###### quaternion imaginary scator algebra

Started by mclarekin on Fractal Image Gallery

0 Replies
181 Views July 02, 2018, 02:20:07 PM
by mclarekin ###### juliaBulb scator algebra addC a

Started by mclarekin on Fractal Image Gallery

0 Replies
164 Views August 12, 2018, 02:37:42 AM
by mclarekin