• January 22, 2021, 01:08:48 PM

Login with username, password and session length

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

0 Members and 1 Guest are viewing this topic.

Offline youhn

  • Fractal Freshman
  • *
  • Posts: 9
  • Shapes only exist in your head
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 plt
import 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 iterations
r = 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 loop
for 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)


Linkback: https://fractalforums.org/fractal-mathematics-and-new-theories/28/mandelbrot-2d-projection-using-geometric-algebra/3987/

Offline youhn

  • Fractal Freshman
  • *
  • Posts: 9
  • Shapes only exist in your head
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.  :confused:



xx
Mandelbrot set interior description with simple geometric objects

Started by marcm200 on Fractal Mathematics And New Theories

5 Replies
543 Views
Last post March 19, 2020, 07:47:52 AM
by marcm200
xx
perturbation algebra

Started by claude on Fractal Mathematics And New Theories

2 Replies
549 Views
Last post May 20, 2019, 06:45:21 AM
by LionHeart
xx
basic algebra problem

Started by woodymnt on Noob's Corner

2 Replies
168 Views
Last post March 30, 2020, 08:58:53 PM
by Adam Majewski
xx
juliaBulb scator algebra addC

Started by mclarekin on Fractal Image Gallery

0 Replies
160 Views
Last post August 12, 2018, 02:36:42 AM
by mclarekin
xx
quaternion imaginary scator algebra

Started by mclarekin on Fractal Image Gallery

0 Replies
146 Views
Last post July 02, 2018, 02:20:07 PM
by mclarekin