Logo by Trifox - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 18, 2024, 10:27:46 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   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: Do quaternions need revisiting?  (Read 1369 times)
0 Members and 1 Guest are viewing this topic.
Roquen
Iterator
*
Posts: 180


« on: June 19, 2013, 09:38:42 AM »

This is a split from this THREAD.

Okay, let me repeat myself: I know pretty much nothing about fractals.  I'm very quickly tossing this together because I'm on vacation at the end of the week and rather throw out something potentially with mistakes and without any deep thought because...well I don't mind proving I'm an awesome dude.  I'm not claiming that any holy grail is contained within quaternions, but from what I've seen...it really seems like they should be revisited.  Oh yeah, I've a thick skin so feel free to mock me if you should feel so inclined. Esp. if all of this is old hat and dead ends.

Quaternions were quickly marginalized for a number of reasons.  The first being that Hamiltion and Tait were mostly interested in the pure mathematics side and didn't focus on applications.  While Gibbs and Heavyside took what they consider to be interesting about quaternions and formulated vectors and stuck to application.  Second is that quaternion notion pretty much sucked, while vector notation was pretty clean.  Then the two camps started the 19th century version of a flame war.  Some fun quotes came out of that, but it certainly didn't help the quaternion camp, who came across as crackpots.  But IMHO the real problem was:  they weren't what people expected.  Complex number have two values, quaternions should have three...what's that all about?  If you directly translate some complex valued function into quaternions...you don't get what you expect.  And that's my point about this seeming aside.  If you take a complex equation simply replace complex with a quaternion...you're probably not getting what you think you are.  Hamilton fell into this trap.  In C a (scaled) rotation about the origin is: p' = rp.  Although Cayley (of linear algebra fame) formulated a generalized unscaled 3D rotation pretty much straight away: p' = rpr-1 and scaled rotations: p' = rpr*..Hamilton resisted these equations for about 10 years.  Jump to today the situation hasn't improved all that much.  Quaternion literature pretty much blow chunks.  The only reasonable paper that comes to mind is an old raytracing new post by Shoemake.  So if there actually is anything of vague interest in here, then I suppose it's because the literature has failed us.

Forgive me in advance for my brain-dump style.  Jumping back to C.  I'll write a complex number as a pair of real values: (x,y)

p' = p2 + c, with c = p0

While this isn't a linear transform globally, it can be viewed as one locally:

p' = rp + t

is a scaled rotation by 'r' followed a translation by 't'.  Where we're simply interpreting 'p' is multiple ways.  So within an infinitesimal region around p we have a linear transform and as we move further way we, speaking loosely, the transform is local feature preserving (I'm not convinced that conformal mapping is required). Expanding things out we have:

p = (x,y), then p' = (x2-y2, 2xy) + p0

which the programmer in me can't help but note that this form leads to catastrophic cancellation and should be reformulated as (probably doesn't make a bit of difference):

p2 = ((x+y)(x-y), 2xy)

Although the explicit representation of complex number is in the form (x,y), it can be viewed to implicitly represent: m(cos(t), sin(t)), where m is the magnitude (m>=0) and t is the torque minimal angle (-pi > t >= pi) with respect to the positive x direction. Other than addition, the action of operators are more clear in this form. Notice that in C a direct represenation of a point and the scaled rotation of (1,0) to that point are identical.

Side-stepping to principle powers, with p = m(cos(t), sin(t)), then:

pr = mr(cos(rt), sin(rt))

Ok, I'm even starting to bore myself so I'll move on.  I saw someone ask: "Isn't this feature mirrored about the x-axis?".  If you use the basic form above, without any extensions this must be true for all points.  Reasoning:  For all points p above the x-axis are a corresponding mirrored points p* and:

(p*p* + c*) = (p2 + c)*

Now for an observation that I haven't seen mentioned:  Folding about the y-axis is related to squaring and can be expressed algebraically as:

(p2)1/2

Of absolutely no interest computationally, but could be useful in reasoning.  And since you can fold about one line, via transforms you can fold about any.  I haven't thought this through, but it seems like this should generalize to any norm-like formulation:

(pr)1/r = m(cos(s), sin(s), where s = (t % (pi/r))

I doubt that there's much use of this since the domain is getting reduced, well for r > 1.  And the root can be dropped for (informally) similar results and I'd guess 'n' way symmetry for integer n.

Back to quaternions and I'll quote myself from the original thread:
Quote
... I can say with a reasonable certainty that all of quaternion based fractals I've seen are based on analytic functions over quaternions.  Regardless the complexity of a given analytic function, the result will be Complex (as in literally) and therefore bound to a plane (and that's a good thing)

I'll write a full quaternion as (s, (x,y,z)) where 's' is the scalar and (x,y,z) is the bivector.  If the scalar is zero, I'll simply write (x,y,z).

In my geometric interpretation of the equation in C we're performing a transform: scaled rotation + translation, where the rotation and translation are both interpretations of the point.  One possible way to construct a similar system in H would be:

p' = qpq* + p0

Notice that p, p' and p0 are all bivectors only (pure quaternions in traditionally speak) so explicitly there are only three components in this formulation.

So the question becomes, what's 'q'?  A first guess could be the quaternion which rotates some unit magnitude point in some reference direction, say r = (1,0,0) into p = (x,y,z). Or:

p = qrq*, so q = sqrt(pr*) = sqrt(x,(0,-z,y)) = sqrt((dot(r,p), cross(r,p))

which reduces to:

p' = qpq*+c = (x2-y2-z2, 2xy, 2xz)+c

compare the form to what we would have got by calling p = (x,(y,z,0)):

p2 = (x2-y2-z2, (2xy, 2xz,0))

Which was my initial purpose.  To translate an equation which generates a surface of revolution (SOR) of the Mandelbrot out of a formulation in C into a logical equivalent in H using geometric operations instead of a direct translation.  So one possible answer the the question "How do we perform the equivalent of squaring in 3D?" in quaternion speak (which extends to say Clifford/Geometric algebras for instance) is:

qpq* where q = sqrt(pr*).

The result squares the magnitude of 'p' and doubles the torque minimal angle with respect to the direction 'r'.

Now there's no reason why 'r' needs to be fixed for all points, nor that it remain fixed across iterations as long the scheme results in sufficient increase of angles globally to get the required folding like effect.  Nor is there any particular reason why the translation couldn't be transformed across iterations and/or pre transformed at the start.  Also instead of directly representing a point it could be implicit and at iteration step the total rotation is the value being updated and the point is simply a temporary.  I'd guess this would be a more promising route...but I'll ignore that and these other additional ideas for the moment.

To not be a SOR requires a non-analytic function..or more simply that all points cannot remain in the complex plane in which they began.  The simplest thing would be just to reflect about an axis through the origin.  So taking the above and toss in a reflection after each rotation:

p' = (x2-y2-z2, 2xy, -2xz)+c

Now this is an obvious thing to try anyway, so I'm sure this isn't too interesting and I'd guess locally it looks like a SOR.  Simply hitting the side with a hammer each turn of the lathe isn't going to change the result all that much.

OK..that's enough garbage to spew in case all of this is old hat.  Oh yeah, and on review for obvious errors I see that my "tone" here sucks and I can't be bothered to rewrite...so really feel free to mock me.

(EDIT: folding stated wrong axis and fixed a couple of spelling mistakes)



« Last Edit: June 19, 2013, 10:22:06 AM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: June 19, 2013, 10:46:05 AM »

a few comments:

- we have LATeX Installed here, might come in handy for more complex formulations
- nice formulations of the complex multiplication, one thing to add: the scaling/rotation is kommutative, seems obvious, but actually really is wink
- the whole approach formulating it using transformations, and the correct transformation to Q is reasonable, as far as i understood
you have defined the complex multiplication for quaternions using the transforms, that is nice, have not fully understood it, how you define
the rotation angle/axis for the third component
- furthermore you gave a formulation just using mirroring/folding for the complex multiplication?

so, question is: HOW DOES IT LOOK LIKE ?  cheesy
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Roquen
Iterator
*
Posts: 180


« Reply #2 on: June 19, 2013, 02:47:29 PM »

LaTeX: check.

q = m(cos(t), sin(t)U), where U is a unit bivector is a counter-clockwise 2t radian rotation about the line through the origin in direction U and a uniform scaling of m2.  (using qpq*)  Note that like complex, log(q) = (log(m), t U)
and exp reverses, but normal identities don't hold since in general since the product doesn't commute.

WRT: reflection...in quaternions? or complex?

What does it look like?  I don't have the knowledge base to develop anything...I'm just attempt to toss out two possible frameworks which I naively expect to be able to create a variety of results.  When I first looked at mandelbulb I was guessing that it was a reduction of some quaternion based equation.  On second glance it's not obvious what the translation would be..but I haven't thought about it much.  Notice that the quadratic formula from wikipedia matches my expansion above and the cubic a double application of 'q'.

If I had time to experiment I'd try this, with m = \sqrt{x^2+y^2+z^2}

x' = \frac{x^2 \left(3 y (m+y)-z^2\right)-\left(y^2+z^2\right) \left(y (m+y)+z^2\right)}{y(m+y)+x^2+z^2}

y' = -\frac{x \left(x^2-3 y^2+z^2\right)}{m}

z' = \frac{x z \left(4 m y+x^2+5 y^2+z^2\right)}{y (m+y)+x^2+z^2}

The translation needs to be added in.  Which if I didn't screw up (I just spewed it out of mathematica) is simply SOR as above followed by doubling the angle with respect to (0,1,0) but without scaling this time. I just pulled this out of my bum to give some example.

Other thing I'd try would be choosing a reference direction per point.  So a projection and normalizing or choosing the closest direction from some finite set.  It seems like there should be tons of options.

Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #3 on: June 19, 2013, 03:05:11 PM »

That equation was dumb...forget I said that.
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #4 on: June 20, 2013, 10:20:37 AM »

Since I've only been looking at equations in Mathematica, I decided to verify the the base of what I was saying was...ya know..correct:

http://glslsandbox.com/e#9541.0

Renders 2D slices of the basic SOR form above.  There's a variable 'center' which does the stupidest thing possible...changes the center of rotation away from the origin.  Nothing interesting can result from this but I figured showing something visual was better than nothing.  SOR-like, but I knew that going in.  Tweek the scale factor and location of center.
« Last Edit: February 19, 2016, 02:14:47 PM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #5 on: June 20, 2013, 11:51:01 AM »

hmm, i cant see a difference when changing the "center" variable
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Roquen
Iterator
*
Posts: 180


« Reply #6 on: June 20, 2013, 12:00:03 PM »

My guess is that you didn't change the scale (the 0.0) multiplier on the outside.
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #7 on: June 20, 2013, 05:49:13 PM »

Just another SOR, but kinda fun: http://glslsandbox.com/e#9541.1

Like before using the center of rotation is disabled at startup.
« Last Edit: February 20, 2016, 02:11:00 PM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #8 on: July 11, 2013, 11:17:56 AM »

One thing I should have noted is that the quaternion doubling equation (like the complex) should probably be reformulated to avoid cancellation.  So here are the three transforms in positive axial aligned directions expanded out and reformed:

Positive X: (x,y,z) -> ((x+y+z)(x-y-z)+2yz, 2xy, 2xz)
Positive Y: (x,y,z) -> (2xy, (x+y+z)(y-x-z)+2xz, 2yz)
Positive Z: (x,y,z) -> (2xz, 2yz, (x+y+z)(z-x-y)+2xy)

Before I can start goofing around in 3D I need to figure out what framework to use (I'm too lazy to make one from scratch or use one that required me creating an analytic derivative for each formulation).  So I goofed around in complex for fun (aka work-avoidance):

Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
kram1032
Fractal Senior
******
Posts: 1863


« Reply #9 on: July 11, 2013, 11:39:39 AM »

Is there supposed to be an image after "work-avoidance):"?
Because I don't see one...
Logged
Roquen
Iterator
*
Posts: 180


« Reply #10 on: July 11, 2013, 11:52:49 AM »

That's because I cleverly clicked post instead of preview.

WebGL examples.  All of these support zooming and panning via mouse.  Some of the later one can have large extents depending on mouse position so zooming out might be needed.  Change the sample size down to either 1 or .5 depending on your GPU.

1) power-2 mandelbrot with rotation not about origin (c = mouse position) HERE:
p' = (p-c)2 + c + p0 = p2 - 2cp + (c+c2) + p0

expanded out there are 3 logical translation terms, last is classic Mandelbrot, the grouped (c+c*c) is Julia, since 'c' is a constant and finally the -2cp term.

2) Same as (1) plus a constant rotation 'r' per iteration (animated in time):  HERE:
p' = r(p-c)2 + c + p0

3) Doubling with respect to two directions per iteration (animated in time):  HERE

4) Like (3) but one is not through the center (again mouse position): HERE

5) Peforms a kaliset like fold (abs of both components) prior to Mandlbrot style: HERE

6) Like (5) but only performing abs on the x-component: HERE
« Last Edit: February 20, 2016, 02:12:37 PM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
kram1032
Fractal Senior
******
Posts: 1863


« Reply #11 on: July 11, 2013, 03:39:17 PM »

those are some beautiful examples smiley
Logged
Roquen
Iterator
*
Posts: 180


« Reply #12 on: July 12, 2013, 03:13:17 PM »

Thanks - quickly hacked them to basic orbit coloring.
http://glslsandbox.com/e#9903.1
http://glslsandbox.com/e#9904.1
http://glslsandbox.com/e#9915.1
http://glslsandbox.com/e#9916.2
http://glslsandbox.com/e#9971.0

« Last Edit: February 20, 2016, 02:11:48 PM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #13 on: August 01, 2014, 03:43:34 PM »

I had a fair number of things to say when I started this thread but keep not have enough free time to type them in.  So I guess I'll breaking into yearly installments. wink

On quaternions I've shown how to formulate the same boring results except that they are now restricted to 3D instead of 4 and are formulated as a generalized rotation.  Boring surface of revolution.  My next intended step was to boringly repeat the same thing under different constructions.  Instead of rotating we scale and manipulate the angle by transforming to a complex plane.  Example double wrt X:  transform P to a complex plane (PX*).  double the angle and square the magnitude by squaring (PX*)2 and transform back to where we started:  (PX*)2X.  Expand this an you get the same results above and likewise for any chosen preferred direction.  Also since quaternion multiplication doesn't commute we can perform the transform/reverse-transform pair on the opposite side, so (PX*)2X = X(X*P)2.

And a third way to do the same thing is to think of the point as being the transform being applied to a point at unit distance in the preferred direction:  PXP* = P*XP is the same as the wrt X doubling above.

Maybe next year I'll type something almost interesting.
« Last Edit: August 17, 2014, 08:37:57 AM by Roquen, Reason: xform X should read xform P » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Alef
Fractal Supremo
*****
Posts: 1174



WWW
« Reply #14 on: August 01, 2014, 06:10:20 PM »

Quaternions needs not only need being revisited, quaternions need dissapier evil
Logged

fractal catalisator
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
3d quasi-Quaternions 3D Fractal Generation « 1 2 » cKleinhuis 16 9381 Last post January 22, 2015, 02:00:18 PM
by cKleinhuis
Revenge of the Quaternions Movies Showcase (Rate My Movie) Power 8 7 1881 Last post January 31, 2011, 12:33:29 AM
by kek
Quaternions Poetry jehovajah 13 2754 Last post December 17, 2012, 10:03:12 AM
by jehovajah
Revisiting the Riemann sphere (again) (new) Theories & Research « 1 2 » msltoe 26 2202 Last post January 05, 2017, 12:27:56 PM
by jehovajah
Quaternions Mandelbulber Gallery mclarekin 1 884 Last post September 12, 2015, 10:35:36 PM
by Buddhi

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