Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => General Discussion => Topic started by: DarkBeam on February 09, 2011, 06:34:15 PM




Title: Quat sum, multiply, divide
Post by: DarkBeam on February 09, 2011, 06:34:15 PM
Dears I need some help with quaternonions. Mandelbulb3D uses quaternonion math that I do NOT know ... :fiery:
What is the formula for;

(a + bi + cj + dk) * (e + fi + gj + hk) = fre() + i * fc1(...) + j * fc2(...) + k * fc3(...)

and

(a + bi + cj + dk) / (e + fi + gj + hk) = fre() + i * fc1(...) + j * fc2(...) + k * fc3(...)

I only am sure that (a + bi + cj + dk) + (e + fi + gj + hk) = (a+e) + (b+f) i + ... (Simple term by term sum)

I need float functions of float coefficients to be inserted in an assembly code. :alien:

 :sad1:

I am not able to find formulas by myself. It is useful for some MB3D formulas; the second is the expression of 4D Mobius map (with a = (a1-a2) and stuff).

I also need;

(a + bi + cj ) * (d + ei + fj ) = fre() + i * fc1(...) + j * fc2(...)

and

(a + bi + cj ) / (d + ei + fj ) = fre() + i * fc1(...) + j * fc2(...)

(Quaternonions without fourth term for simplified code in 3D only)  :dink:


Title: Re: Quat sum, multiply, divide
Post by: DarkBeam on February 09, 2011, 07:05:58 PM
I found the answer;

product = a1a2 − b1b2 − c1c2 − d1d2
+ (a1b2 + b1a2 + c1d2 − d1c2)i
+ (a1c2 − b1d2 + c1a2 + d1b2)j
+ (a1d2 + b1c2 − c1b2 + d1a2)k

Is it correct?

And;

z^(-1) = z / det(z) where det(z) = a*a + b*b + c*c + d*d

so composing the two formulas should give the final answer O0


Title: Re: Quat sum, multiply, divide
Post by: Fractal Ken on February 09, 2011, 08:28:30 PM
Darkbeam,

Your formula for the product (a1 + b1i + c1j + d1k)(a2 + b2i + c2j + d2k) looks right.

I believe the reciprocal of a quaternion is its conjugate divided by its squared norm. In other words, if z = a + bi + cj + dk, then

     z-1 = z* / ||z||2 = (a - bi - cj - dk) / (a2 + b2 + c2 + d2)

Here's a picky point about the quotient of two quaternions: It's not uniquely defined. We could interpret p/q as meaning either pq-1 or q-1p, and they're not generally equal due to the noncommutativity of quaternion multiplication.

The Wikipedia article on quaternions (http://en.wikipedia.org/wiki/Quaternion) has loads of good information.

Regards,
Ken


Title: Re: Quat sum, multiply, divide
Post by: DarkBeam on February 09, 2011, 08:54:03 PM
Okay ty :D