Logo by simon.snake - 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: Visit us on facebook
 
*
Welcome, Guest. Please login or register. May 08, 2024, 02:05:57 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 2 [3] 4 5 ... 7   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: Re: Custom formulas & transforms - Release  (Read 6028 times)
0 Members and 1 Guest are viewing this topic.
fractalrebel
Fractal Lover
**
Posts: 211



WWW
« Reply #30 on: February 23, 2011, 06:57:24 PM »

As Dave Makin mentioned earlier there are alternate ways to calculate a quaterionion power since quat multiplication does not commute. Here are the alternate methods I have in my quaternion math library:

; Quaternian power calculated as exp(ln(Q1)*Q2)
  static func Qpower(Vector a, Vector b, Vector c)
;    Q1^Q2 = exp(ln(Q1)*Q2)
;   Find the log of Q1
    float norm = sqrt(a.m_y*a.m_y + a.m_z*a.m_z + a.m_w*a.m_w)
    if norm == 0
      norm = 1e-100
    endif
    complex z = a.m_x + flip(norm)
    z = log(z)
    float at = imag(z)/norm
    float x1 = real(z)
    float y1 = at*a.m_y
    float z1 = at*a.m_z
    float w1 = at*a.m_w
;   Multiply log by Q2
    float dot = y1*b.m_y + z1*b.m_z + w1*b.m_w
    ; calc V x V
    float y2 = z1*b.m_w - b.m_z*w1
    float z2 = -(y1*b.m_w - b.m_y*w1)
    float w2 = y1*b.m_z - b.m_y*z1

    float x2 = x1*b.m_x-dot
    y2 = y2 + x1*b.m_y + b.m_x*y1
    z2 = z2 + x1*b.m_z + b.m_x*z1
    w2 = w2 + x1*b.m_w + b.m_x*w1
;   Take the exponential
    norm = sqrt(y2*y2 + z2*z2 + w2*w2)
    if norm == 0
      norm = 1e-100
    endif
    z = x2 + flip(norm)
    z = exp(z)
    at = imag(z)/norm
    c.m_x = real(z)
    c.m_y = at*y2
    c.m_z = at*z2
    c.m_w = at*w2
  endfunc

; Quaternian power calculated as exp(Q2*ln(Q1))
  static func Qpower2(Vector a, Vector b, Vector c)
 ;    Q1^Q2 = exp(Q2*ln(Q1))
 ;   Find the log of Q1
     float norm = sqrt(a.m_y*a.m_y + a.m_z*a.m_z + a.m_w*a.m_w)
     if norm == 0
       norm = 1e-100
     endif
     complex z = a.m_x + flip(norm)
     z = log(z)
     float at = imag(z)/norm
     float x1 = real(z)
     float y1 = at*a.m_y
     float z1 = at*a.m_z
     float w1 = at*a.m_w
 ;   Multiply log by Q2
     float dot = y1*b.m_y + z1*b.m_z + w1*b.m_w
     ; calc V x V
     float y2 = -z1*b.m_w + b.m_z*w1
     float z2 = (y1*b.m_w - b.m_y*w1)
     float w2 = -y1*b.m_z + b.m_y*z1

     float x2 = x1*b.m_x-dot
     y2 = y2 + x1*b.m_y + b.m_x*y1
     z2 = z2 + x1*b.m_z + b.m_x*z1
     w2 = w2 + x1*b.m_w + b.m_x*w1

 ;   Take the exponential
     norm = sqrt(y2*y2 + z2*z2 + w2*w2)
     if norm == 0
       norm = 1e-100
     endif
     z = x2 + flip(norm)
     z = exp(z)
     at = imag(z)/norm
     c.m_x = real(z)
     c.m_y = at*y2
     c.m_z = at*z2
     c.m_w = at*w2
  endfunc
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #31 on: February 25, 2011, 11:08:22 AM »

 grin Thanks for the suggestions! ps. are you "reb" of the UF database? You are a genius Azn

The quats in UF database seems to use the bicomplex theory. I use the classic Hamilton theory and for now I prefer to use it for all computations.

Now I succeeded in coding log() and exp(). The problem is that exp(log(Q)) = Q only in a zone near to origin.

So to plot the arbitrary power fractal I must cut off everything outside. wink Else, an ugly noise will surround the fractal and the computations will be slowed down. undecided I hope that this will be enough  cheesy
Logged

No sweat, guardian of wisdom!
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #32 on: February 25, 2011, 12:01:22 PM »

I remembered that I asked Jesse for making a test with a complex-power formula, and he had problems because the distance estimation algorithm didn't work well with that. Look: http://www.fractalforums.com/index.php?topic=5252.msg26722#msg26722
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #33 on: February 25, 2011, 12:09:45 PM »

That's the 2D section of the sequence. 3D image looks completely wrong,  undecided


* aaaaa iko.jpg (81.72 KB, 724x654 - viewed 104 times.)
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #34 on: February 25, 2011, 12:16:42 PM »

This is much better, who knows why? But high powers are destructive cry


* aaaaa iko.jpg (90.12 KB, 724x654 - viewed 99 times.)
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #35 on: February 25, 2011, 01:28:54 PM »

yesssss!!! Now all works fine. I simply replaced some options at the start of each function and everything is correctly plotted cheesy cheesy cheesy cheesy cheesy cheesy cheesy

Now I only have to write the final formula combining everything in one! afro


* aaaaa iko.jpg (124.96 KB, 724x1232 - viewed 106 times.)
Logged

No sweat, guardian of wisdom!
ericr
Fractal Fanatic
****
Posts: 318


« Reply #36 on: February 25, 2011, 05:58:12 PM »

Thank you very for all  this formulas Thank you

ERIC
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #37 on: February 25, 2011, 06:03:40 PM »

Thank you very for all  this formulas Thank you

ERIC


Without your suggestion of the source code of that old program I would never be able to write anything. The base code is very tricky... kiss
Logged

No sweat, guardian of wisdom!
ericr
Fractal Fanatic
****
Posts: 318


« Reply #38 on: February 26, 2011, 09:20:00 AM »

can i give you other idea or have you not the time




example: cos(q)=(exp(qi)+exp(-qi))/2   the cosine in quaernions !
            sin(q)= (exp(qi)-exp(-qi))/2

etc .....      the moste difficulte is done
thank you eric
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #39 on: February 26, 2011, 09:24:30 AM »

can i give you other idea or have you not the time




example: cos(q)=(exp(qi)+exp(-qi))/2   the cosine in quaernions !
            sin(q)= (exp(qi)-exp(-qi))/2

etc .....      the moste difficulte is done
thank you eric

Yesterday I found some quat math libraries. In reality;

sin(a+bi) = sin a * cosh b + i ( cos a * sinh b ) (sine for a complex number)

But in our case;
m = sqrt( w^2+y^2+z^2 )
so x = sin x * cosh m (real part is simple)
but
y = ( cos x * sinh m ) / m * y
z = ( cos x * sinh m ) / m * z
w = ( cos x * sinh m ) / m * w
The division is the tricky part to code grin
 
(I hope I understood well the cryptic library embarrass )
I have all the codings for sinh and cosh already done in assembly wink ... Will see! grin (sin S)^2 + C must be a wonderful fractal!
« Last Edit: February 26, 2011, 09:32:17 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
skyzyk
Alien
***
Posts: 26


Aspire to Inspire, before you expire.


WWW
« Reply #40 on: March 02, 2011, 05:11:19 PM »

Thank you very much Luca. No words to express the many thanks I have for your dedication to show us The Possibilities Are Infinite. Sorry if I've said that before but it's the same every revision.  cheesy wink cheesy
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #41 on: March 02, 2011, 05:13:22 PM »

Thank you very much Luca. No words to express the many thanks I have for your dedication to show us The Possibilities Are Infinite. Sorry if I've said that before but it's the same every revision.  cheesy wink cheesy

You are too kind cheesy embarrass
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #42 on: March 06, 2011, 01:44:42 PM »

Finally Jesse told me how to use transforms as pre-transforms!  wink wink wink

I wrote this in the first post, opens an immense field of new possibilities.

I will write new options for (hopefully) all transforms for complete / partial transforms now! grin
Logged

No sweat, guardian of wisdom!
visual.bermarte
Fractal Fertilizer
*****
Posts: 355



« Reply #43 on: March 06, 2011, 02:03:41 PM »

Hello, I'm testing inversions and things on GPU..interessante!! smiley
dodeca kifs with invcylindrical-hack
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #44 on: March 06, 2011, 06:27:23 PM »

Hello, I'm testing inversions and things on GPU..interessante!! smiley
dodeca kifs with invcylindrical-hack
<Quoted Image Removed>
grin why "hack"? wink
Logged

No sweat, guardian of wisdom!
Pages: 1 2 [3] 4 5 ... 7   Go Down
  Print  
 
Jump to:  


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.182 seconds with 24 queries. (Pretty URLs adds 0.012s, 2q)