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: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. April 20, 2024, 02:19:53 AM


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: Clarification of the bugman generalised formulas  (Read 4518 times)
0 Members and 1 Guest are viewing this topic.
ZsquaredplusC
Guest
« on: November 26, 2009, 04:38:09 AM »

I have a quick and hopefully easy question.

I have got the trig formulas working, but am having problems with the non-trig formulas here
http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8680/#msg8680

z[0,1,2]=z[x,y,z]
c[0,1,2]=complex "+c"

Currently using the trig formulas...
    z[0]=power(R,pow)*cos(pow*ph)*cos(pow*th)+c[0]
    z[1]=power(R,pow)*cos(pow*ph)*sin(pow*th)+c[1]
    z[2]=power(R,pow)*sin(pow*ph)+c[2]

But when I use the non trig (the following is for positive power 2)...
     rxy=sqrt(z[0]*z[0]+z[1]*z[1])
     a=1-z[2]*z[2]/rxy*rxy

     ztmp[0]=(z[0]*z[0]-z[1]*z[1])*a
     ztmp[1]=2*z[0]*z[1]*a
     ztmp[2]=2*z[2]*rxy

     z[0]=ztmp[0]+c[0];
     z[1]=ztmp[1]+c[1];
     z[2]=ztmp[2]+c[2];

I get no results.  And the iteration loop seems to hang like it is stuck waiting for the bounding volume to be exceeded or the epsilon closeness value to be triggered?
Is there something obviously wrong here?

Z starts at 1,0,0

Any ideas?  It would be great to get these speedups and save the trig calculations

Logged
ZsquaredplusC
Guest
« Reply #1 on: November 28, 2009, 07:15:12 AM »

OK, maybe I wasn't clear or my code wasn't clear.  I will try again.  Please help if you have code working using Paul's (bugman) non trig versions.

The usual trigonometric formulas...

zx=power(R,pow)*cos(pow*ph)*cos(pow*th)+cx
zy=power(R,pow)*cos(pow*ph)*sin(pow*th)+cy
zz=power(R,pow)*sin(pow*ph)+cz

Now, when trying to replace the above trig versions with Paul's non-trig versions from
http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8680/#msg8680
I get the following for power +2

In the mathematica output (sorry I cannot do latex) he shows...
rxy=sqrt(sqr(zx)+sqr(zy))
and then for the power 2 version the rest is
{x,y,z}^2={{x^2-y^2}a,2xya,2zrxy},a=1-z^2/rxy^2

So I am assuming (please correct me if I am wrong) that you first calculate rxy and a and then feed them through the formula for power 2.

This is how I attempted in the first post of this thread with the code;

Firstly work out the values for rxy and a...
rxy=sqrt(zx*zx+zy*zy)
a=1-sqr(zy)/sqr(rxy)

Then use a temp varialable to track the new xyz...
zxtmp=(sqr(zx)-sqr(zy))*a
zytmp=2*zx*zy*a
zztmp=2*zz*rxy

Then assign the new xyz values plus the C constant...
zx=zxtmp+cx
zy=zytmp+cy
zz=zztmp+cz

And this is also for the Z=Z^pow+C calculations right?  The distance estimation calculations still need to use the log etc?

Am I interpreting the mathematica output correctly?  The only change I have made from working trig functions to non-working non-trig formulas is as above.

Thanks for any insight.  wink
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #2 on: November 28, 2009, 04:40:37 PM »

I get the following for power +2

In the mathematica output (sorry I cannot do latex) he shows...
rxy=sqrt(sqr(zx)+sqr(zy))
and then for the power 2 version the rest is
{x,y,z}^2={{x^2-y^2}a,2xya,2zrxy},a=1-z^2/rxy^2

So I am assuming (please correct me if I am wrong) that you first calculate rxy and a and then feed them through the formula for power 2.

This is how I attempted in the first post of this thread with the code;

Firstly work out the values for rxy and a...
rxy=sqrt(zx*zx+zy*zy)
a=1-sqr(zy)/sqr(rxy)

Then use a temp varialable to track the new xyz...
zxtmp=(sqr(zx)-sqr(zy))*a
zytmp=2*zx*zy*a
zztmp=2*zz*rxy

Then assign the new xyz values plus the C constant...
zx=zxtmp+cx
zy=zytmp+cy
zz=zztmp+cz
Thanks for any insight.  wink

You've used sqr(zy) instead of sqr(zz) in "a=1-sqr(zy)/sqr(rxy)"
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
ZsquaredplusC
Guest
« Reply #3 on: November 29, 2009, 12:58:35 AM »

Thanks David.  That error was just in my typing.  It is the correct sqr(zz) as in the first post.
Must be some other error in the my surrounding code then.

Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #4 on: November 29, 2009, 01:04:18 AM »

Thanks David.  That error was just in my typing.  It is the correct sqr(zz) as in the first post.
Must be some other error in the my surrounding code then.



In case it helps at all here's my UF iteration (for the -sine version):

            zri = sqr(zri)*(1.0 - sqr(zj)/(r=|zri|)) + cri
            zj = -2.0*zj*sqrt(r) + cj

zri and cri are complex and |zri| is x^2+y^2 where zri = (x+i*y), the other terms are reals.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #5 on: November 29, 2009, 12:15:07 PM »

I just realised that you didn't mention testing for zero.

Assuming you calculated the square of the magnitude for bailout purposes then try the following:

Before the iteration loop precalculate the magnitude^2 (i.e. x^2+y^2+z^2)

At the beginning of the iteration loop if the magnitude^2 is zero then set the value to the constant i.e. z[0]=c[0], z[1]=c[1],z[2]=c[2] otherwise do the calculation as normal.
Obviously at the end of the loop calculate the new value of the magnitude^2 which is then used for bailout and at the start of the next loop.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
UltraFractal 5 - New Formulas UltraFractal cKleinhuis 1 4767 Last post August 07, 2008, 06:28:42 PM
by GFWorld
How to test simply new formulas ? The 3D Mandelbulb arnaud.bodin 2 6115 Last post March 06, 2010, 01:00:12 AM
by makc
has anybody tried using ifs formulas with the mandelbuld/mandelbox formulas? 3D Fractal Generation cKleinhuis 4 14412 Last post May 05, 2010, 03:17:07 PM
by Power 8
More Formulas? Mandelbulb 3d The Rev 2 3980 Last post November 21, 2010, 11:51:25 PM
by The Rev

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.126 seconds with 25 queries. (Pretty URLs adds 0.006s, 2q)