Creating lists of 4D "points"

I am trying to create a full 4D quaternion-based mandelbulb in desmos using definitions from .desmos.com/calculator/5aok5agmrf (I couldn’t find the original quaternion one so I settled for an octonian link by someone else). I have currently implemented it for evaluating singular points, but I can’t figure out how to make some sort of list of coordinates that 1. creates a “grid“ of 4D points and 2. works in desmos but I can also call specific parts from the list such as real, i, j, k. Desmos doesn’t support 4D points obviously and I can’t get it to work just using (X, Y)forX=, Y=, Z=, W= because there are duplicates (I was assuming each coordinate (x1, y1), (x2, y2) would count as 1 4D coordinate, so real would be L.x[1, 3, 5,…], i would be L.y[1, 3, 5,…] j would be L.x[2, 4, 6,…] ect…). After that, it should work, just testing for f(iterations)<2 at each 4D point.

That’s really interesting.
I’m not sure I understand your issues.
Obviously Desmos doesn’t support quaternions natively, so we have to define the operations and then we have to use a projection into the 3D space to show them.
Can you share your code?

P.S. Even though I can’t get a real list of 4D points I need some sort of method to reliably do so, which is currently a+bi+cj+dk≡(a, b), (c, d)

Currently I have been using a system where its A_{0}=\left(X,\ Y\right)\operatorname{for}X=a_{0},\ Y=a_{0}, B=\left(X,\ Y\right)\operatorname{for}X=A_{0}.x,\ Y=A_{0}.x, a_{0}=\left[-1,…1\right], however testing for unique(B) says that there are tons of repeats (unique(B)<count(B)). Then, I would do Q=\operatorname{join}\left(\left(B.x\left[1,\ 3,\ 5,…\right],\ B.y\left[1,\ 3,\ 5,…\right]\right),\ \left(B.x\left[2,\ 4,\ 6,…\right],\ B.y\left[2,\ 4,\ 6,…\right]\right)\right) because the original quaternion thing that it was based on used lists of 4 values so basically [1, 2i, 3j, 4k]. I would then call for real: \left[1,…\frac{\operatorname{length}\left(Q\right)}{4}+1\right], i: \left[\frac{\operatorname{length}\left(Q\right)}{4}+1,…\frac{2\operatorname{length}\left(Q\right)}{4}+1\right], ect… because the original functions defined from desmos .com/calculator/u6cmix4jzc used quaternions defined with lists, calling the first, second, third and fourth values for Re i j k. The problem I have here is that I build everything around being able to have a way to have a list of all of those values, stored as (Re, i), (j, k). But now I cant reliably create a 4D “Grid“ of points. My graph is here: desmos .com/calculator/xe5ebdqesx for my quaternion for lists of quaternions and desmos .com/3d/lns2moycey for mandelbulb which can evaluate singular iterations at singular 4D quaternion points.

So, I’m not familiar with Mandelbrot in 3D (Mandelbulb) using quaternions …
I’m trying to understand how it works.
In doing so I tried to simplify the code a bit and I think I found some bugs:
https://www.desmos.com/calculator/bypppbrprf

for example if you consider the definition of M_a
the last factor cannot be
y_1[3 length(A)/4 … 4 length(A)/4+1]
because 4 length(A)/4+1 = length(A)+1 and this is out of the bounds of the array.
I think it should be y_1[3 length(A)/4 … 4 length(A)/4].

So, I get that we do something similar to Mandelbrot in 2D …
but I don’t understand when you say that the problem is the 4D grid.

What I was doing was defining a+bi+cj+dk as (a, b), (c, d). I could find a reliable way to generate all possible combinations of a, b, c, d where a=b=c=d=[-Range,…Range]. This is so that I can sample as many points as possible, then set a conditional where it only graphs if its inside the fractal. I basically need a way to sample every possible point that could be in the mandelbulb and then only plot if its in the fractal.

The problem, if I understand the situation correctly, is that you represented a quaternion with a list [(a,b), (c,d)], that is: a list of two points.
So if you want to generate a grid of points you should do something like
[(a,b), (c,d)] for a=Range, b=Range, c=Range, d=Range
and this is not allowed because you would generate a list of lists (which are not supported in Desmos).

So you could represent a list of quaternions as a simple list of real values taking the elements of the list four at a time.

Otherwise you could use a function to generate all the possible values for points in your grid of quaternions, like this (see function Q):

https://www.desmos.com/calculator/lrpvdv8dic

for any integer value you get a quaternion of the grid

Does this help?

If I’m understanding correctly, which I don’t claim to, you want a set of unique four coordinate points? So, I’d generate lists for each coordinate (keeping the same order in each list comprehension is important), and function Q_List would return the set of coordinates at a particular index.

1 Like

The four functions in this graph, r1 … r4 do generate the lists Daniel says …
And the function Q(k) gives you the k-th quaternion of the list:

https://www.desmos.com/calculator/lrpvdv8dic

1 Like

So I’m just repeating the simplest part of @Guzman_Tierno ‘s. :laughing:

YESS!!

Thank you so much I think it works now but I havent implemented it yet

Here’s the same code in 3D:

https://www.desmos.com/3d/ekfu5murgy

But you can only have a cubic grid whose side is smaller than 10 because otherwise the list gets bigger than 10.000 elements and this is not supported.

You can use the slider s to see a projections of the quaternions moving.

You will have to do every calculation for the Mandelbulb component-wise
because you cannot have a list of quaternions.

I implemented in the original mandelbulb code and now it says “definitions are nested too deeply“

Also the power function P(x, y) doesn’t seem to be working. It keeps on returning undefined, I think the problem is the M(y, ln(x)). The multiplication function isn’t working with the decimal outputs of the ln() function

I’m sorry, there are too many things together and I can’t undestand how everything works.
I do not get the error “too deeply nested” … maybe you solved it … but on the other hand the graph doesn’t show anything.
Maybe you can start a new graph introducing things step by step …

I solved the grid problem but now i have a new problem which is the Definitions are nested too deeply problem. Am I supposed to make a new topic or can I use this one?

You can use this one …
I’m not getting that error … where and how do you get that error?

I get the nested too deeply error after I plug in everything into the iteration. Also, the power function isn’t working P(Q1, Q2)

Its in the link R Project #38b [Mandelbulb Quaternion] | Desmos . The problem can be found in the “Points“folder. I was testing out f(100) for the iterations, and it said definitions nested too deeply.