Logo by DsyneGrafix - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. September 23, 2021, 04:45:45 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Triplex problem  (Read 2236 times)
0 Members and 1 Guest are viewing this topic.
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« on: March 02, 2012, 10:20:12 AM »

I'm making a Mandelbulb in Processing and I have a version that works by using rotation with Spherical Coordinates and wanted to make one that works with triplex multiplication. So far I only tried doing a triplex version of z = z^2+c (instead of Mandelbulb z = z^8+c) but the result was a slightly 3D Mandelbrot (the sides have a round bulge). I apologize if there is a better name for this, but it is not the same as my result for the rotation method to the second power. I'll post images of both at the bottom.

I'm using this as reference: http://www.fractalforums.com/theory/triplex-algebra/

Specifically I thought I'd use this part:

{x1, y1, z1}*{x2, y2, z2} = {(x1*x2-y1*y2)*(1-(z1*z2)/(p1*p2)), (x2*y1+x1*y2)*(1-(z1*z2)/(p1*p2)), p1*z2+p2*z1}

p1 = sqrt(x1*x1+y1*y1)
p2 = sqrt(x2*x2+y2*y2)

I made the assumption that if (x1, y1, z1) is z then (x1, y1, z1) is equal to (x2, y2, z2) because I'm trying to square z. This is the section of my code that is supposed to be doing the z = z^2+c math:

Code:
float nx = x;
float ny = y;
float nz = z;
int n = 0;
while (n < maxIterations) {
  float p = sqrt(nx*nx+ny*ny);
  float tx = (nx*nx-ny*ny)*(1-(nz*nz)/(p*p));
  float ty = (2*nx*ny)*(1-(nz*nz)/(p*p));
  float tz = 2*p*nz;
  nx = tx+x;
  ny = ty+y;
  nz = tz+z;
  if (nx*nx+ny*ny+nz*nz > 4) break;
  n++;
}

Still working on rendering the points better... hopefully it is still obvious what fractals these are.

Result from rotation method at z = z^2+c and max iterations of 10:


Result from triplex method at z = z^2+c and max iterations of 10:
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #1 on: March 02, 2012, 10:08:19 PM »

Ok, simpler question, is the section of that triplex math I took meant to be interchangeable with the rotation method of generating a Mandelbulb? I don't see any mistakes in my math... I just don't know all these terms and they are difficult to find with Google.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #2 on: March 02, 2012, 10:25:22 PM »

your assumption is correct, but the multiplication is developed from the exponentiation, hence you just need to implement the exponentiation, which is the first
and i would suggest you include the exponentiation because of easier playing with other exponents

after you got this you just need the "+" operation which is standard vector math

and just remember, if z=0 it is standard complex algebra
Logged

---

divide and conquer - iterate and rule - chaos is No random!
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #3 on: March 03, 2012, 01:49:51 AM »

Ok, I understand what you mean about it being standard complex algebra if z = 0, I didn't notice that when I wrote it. I guess that explains how I got a "fat" Mandelbrot (if I rotate the image it bulges both directions along the z-axis).

Please forgive my lack of math knowledge, but which is the exponentiation one? The one that is after "The power formula is based on two consecutive rotations..."?

To be honest when I wrote the code for the non-trig one (what I posted earlier) I expected it to be a Mandelbulb at power 2 like my rotation method. I don't understand what I need to change to make the non-trig one work like the rotation method.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #4 on: March 03, 2012, 03:26:49 PM »

yes, this is the exponentiation or power formula, a standard mandelbrot is retrieved when using "2" as "power"
both 3d fractals look rather disappointing in the power2 mode, and the original mandelbulb is a power8 mandelbrot
fractal
 
a good test if your formula is correct is to just render the z=0 plane, which should yield you then a mandelbrot,
then you just need to inspect the z= part of the formula to make it correct

both formulas yield mandelbrot shape in z=0 plane!

side note:
just to let you know what you are doing: the original bailout is sqrt(z)<4, you let the sqrt away, but it would be better
to use z<16 as bailout, because sqrt(16)=4, this way you can ommit the sqrt in the bailout test, or you know what
you where doing, then the 4 is fine because you experimented already with the bailout limit wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #5 on: March 03, 2012, 11:20:05 PM »

Opps, thanks for catching that, I forgot to make 4 be 16 for the bailout. It seems to look just about the same as 16 but making it 4 wasn't intentional.

I think what I've been calling the "rotation method" is the exponentiation / power formula. It does correctly make a Mandelbulb if I set its power to 8 and it made the first image I posted (which is power 2). What I think I'm not getting is why the non-trig method made a different image (also at power 2). Is it supposed to make a different image?

Below is the point testing for the rotation method which I think is the exponentiation / power formula. It works correctly, but it depends on a lot of sqrt, atan2, sin, and cos. This is slow and why I wanted to make the non-trig code that would hopefully make the same images.

Code:
float rad = sqrt(x*x+y*y+z*z);
float phi = atan2(z, x);
float phiLength = sqrt(x*x+z*z);
float theta = atan2(phiLength, y);
float nx = x;
float ny = y;
float nz = z;
int n = 0;
while (n < maxIterations) {
  float nRad = sqrt(nx*nx+ny*ny+nz*nz);
  float nPhi = atan2(nz, nx);
  float nPhiLength = sqrt(nx*nx+nz*nz);
  float nTheta = atan2(nPhiLength, ny);
  nx = cos(nPhi*power)*sin(nTheta*power)*pow(nRad, power)+cos(phi)*sin(theta)*rad;
  ny = cos(nTheta*power)*pow(nRad, power)+cos(theta)*rad;
  nz = sin(nPhi*power)*sin(nTheta*power)*pow(nRad, power)+sin(phi)*sin(theta)*rad;
  if (nx*nx+ny*ny+nz*nz > 16) break;
  n++;
}

Sorry if I'm starting to drive you crazy with these clarifications but I don't understand if the non-trig code is supposed to make the same images as the exponentiation code. Are they supposed to make different fractals?
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #6 on: March 04, 2012, 12:12:49 AM »

the non trig is supposed to make the same image, just check your formula carefully, usually its just a sign +/- error, or something similar easy to overlook
Logged

---

divide and conquer - iterate and rule - chaos is No random!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #7 on: March 04, 2012, 12:16:59 AM »

Probably you did not change z's sign
Logged

No sweat, guardian of wisdom!
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #8 on: March 04, 2012, 08:15:09 PM »

I finally got it! It smokes my exponentiation code speed wise smiley


Code:
float nx = x;
float ny = y;
float nz = z;
int n = 0;
while (n < maxIterations) {
  float tx = (nx*nx-ny*ny)*(1-(nz*nz)/(nx*nx+ny*ny));
  float ty = 2*nx*ny*(1-(nz*nz)/(nx*nx+ny*ny));
  float tz = -2*nz*sqrt(nx*nx+ny*ny);
  nx = tx+x;
  ny = ty+y;
  nz = tz+z;
  if (nx*nx+ny*ny+nz*nz > 16) break;
  n++;
}

I found bugman's website that had a similar equation to the one I was using: http://bugman123.com/Hypercomplex/

Next step is to render it better and then do the triplex method for each increasing power up to 8. Thank you in particular to cKleinhuis for your patience helping out.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #9 on: March 04, 2012, 08:20:05 PM »

congrats wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Triplex Flower Images Showcase (Rate My Fractal) Pauldelbrot 2 983 Last post February 26, 2009, 01:57:39 AM
by Pauldelbrot
Triplex Algebra Fractal Fun Power 8 0 1651 Last post April 04, 2010, 09:24:01 PM
by Power 8
A generalization of triplex z^p+c Theory « 1 2 » Furan 20 3072 Last post March 09, 2013, 07:12:14 PM
by kram1032
triplex math - you know what i think of ? (new) Theories & Research « 1 2 » cKleinhuis 27 710 Last post June 18, 2013, 10:23:48 AM
by Roquen
Triplex Algebra with Triplex Multiplication Theory n4t3 10 2860 Last post August 14, 2013, 07:17:50 AM
by n4t3

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.2 seconds with 25 queries. (Pretty URLs adds 0.014s, 2q)