📱 Erkannter Endgerättyp ⛱️ Tag und Nacht. Verbraucht keinen oder einen 🍪.
guest
Login 🍪 0 Anzahl Ihrer gespeicherten Kekse, führt zur Keksdose

Geometric Algebra

These instructions are written with a maximum of 4 working units - it may look and sound dumb, but you can learn it while juggling life and not be in a campus environment. Education i found online requires you to have 10 units and more and that's only possible in a walled garden campus with money and no side job among like minded peers after someone started to believe in you and gave you this setup.

It is not needed here. You can be hangover, high, tired and have stuff to deal with next to this.

  • 1 working unit for an operation/function

  • up to 2 working units for parameters

  • 1 working unit for the result.

so

fn(x, y): z

1  2  3   4

rinse and repeat.

If you like to learn more about this i heard its the Cowan’s 4-Chunk Limit

Im sure and know that if you are not distracted building 20 unit stuff is possible. But to build a knowledge graph its an easy process

  1. go from start to end taking all steps in the list (waterfall / list)

  2. diverge at one step and build a different goal (tree)

  3. go from a different start to a different goal but use and link some of the known steps back (graph)

As you can always take 1 step to the next node using fn(x,y):z i suppose all documentation can be done in linked graphs and output to trees and lists while being high. And knowing highschool math - you can only endure pq and i while being high!

So lets waterfall 1 task:

Rotating a vector (v)

How?

Mirror it along another (u)!

how to find this other (u)? later.

if you found it (u)

  1. find u_parallel_to_v (dot) and u_perp_to_v (wedge)

  2. when you subtract those that's the new v' - rotated:

so

v' = u_parallel - u_perp

do it on paper once.

Shitty U V Para Perp

If yours is less shitty that's passed

Multiplying

you get a multivector by multiplying 2 vectors.

The form of this multivector depends on the dimensions of the vectors multiplied. In 2D thats just 2 values you can look at like any other 2D vector. Because x and y components are simply cos and sin of the angle. Its similar in higher dimensions.

v (4,3) u (5,8)

you multiply these to a geometric product like

uv = u · v + u ∧ v

this gets you a 2D Rotor grade 0 scalar + grade 2 bivector

uv  = uₓvₓ(e₁e₁) + uₓvᵧ(e₁e₂) + uᵧvₓ(e₂e₁) + uᵧvᵧ(e₂e₂)
         1            e₁e₂        -e₁e₂       1

    = (uₓvₓ + uᵧvᵧ) + (uₓvᵧ - uᵧvₓ)e₁₂ (dot and wedge) <-- 2 floats so we usually want this one

    = |u| |v| (cos(θ) + e₁₂ sin(θ)) (polar form)

    = |u| |v| e^(e₁₂θ) (euler form)

You can also use a sin(θ) e₁₂ notation instead of e₁₂ sin(θ) as it commutes (scalar)

Polar and euler form - Why is this |u||v| ? its the length of the rotor but where is √ and ² ?!

  • Lenght of a vector is √(x² + y²)

  • factor in |u| |v| --> √( (|u| |v| cos θ)² + (|u| |v| sin θ)² )

  • distribute ² √( (|u|² |v|² cos² θ) + (|u|² |v|² sin² θ) ) - dont be confused about sin² its (sin(θ))²

  • factor out |u|² |v|² --> √( |u|² |v|² (cos²θ + sin²θ) ) - now you may know cos²θ + sin²θ is always 1² as its the unit circle

  • Ultimately √(|u|² |v|²) --> |u| |v|

Thats a rotor2

you can now normalize this by doing

uv / |uv|

thats possible because both s and e₁₂ are prepended by a scalar. Helpful as using non-normalized rotors things get ugly

but its not the half angle yet we want to mirror a vector with so it rotates

We have a cos / grade 0 / x and sin e₁₂ / grade 2 / y

This gives you a triangle with an angle θ. Now to get half that angle in any rotor not just normalized ones you need to build a parallelogram or better: rhombus.

∧
|                
|           
|           Biv (4, 3)         
|       /             
|  /              
+---------------------->
0  1  2  3  4

to do so imagine what happens when you extend x by the length/magnitude of the bivector but keep the height y the same

∧
|                
|                  
|           old (4,3)      Biv (9, 3)   
|       /         -             
|  /     -             
+---------------------->
0  1  2  3  4  5  6  7  8  9

Thats now exactly half that angle. Why? Where is the rhombus hidden?

Y (Bivector)
^
|            (4,3) = uv ---------------- (9,3) = uv + |uv|
|           /  .                        /
|         /      .                    /
|   L=5 /          . (Diagonal)     /  L=5
|     /              .            /
|   /                  .        /
| /                      .   /
+--------------------------+-------------> X (Scalar)
(0,0)                      5

There it is! As you can see no matter the values - this is always the half angle.

Proof:

  • Write the geometric product in polar form

    • R = uv = |u||v| ( cos(θ) + sin(θ) e₁₂ )
  • add the length!

    • R = |u||v| + uv = |u||v| + |u||v|( cos(θ) + sin(θ) e₁₂ )
  • factor length out!

    • R = |u||v| ( (1 + cos(θ)) + sin(θ) e₁₂ )
  • https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Multiple-angle_and_half-angle_formulas gives us

    • cos (2 θ) = 2cos²(θ) - 1 --> 1 + cos (2 θ) = 2cos²(θ) --> 1 + cos (θ) = 2cos²(θ/2)
    • sin (2 θ) = 2 sin(θ) cos (θ) --> sin (θ) = 2 sin(θ/2) cos (θ/2)
  • substitute

    • |u||v| [ (2 cos² (θ/2) + (2 sin (θ/2) cos (θ/2)) e₁₂) ] <-- all share 2 cos (θ/2)
  • factor out 2 cos (θ/2)

    • R = [ |u| |v| 2 cos (θ/2) ] * ( cos (θ/2) + sin(θ/2) e₁₂)
  • done. now assuming your rotor is normalized all |u| |v| 2 cos (θ/2) would be gone leaving cos (θ/2) + sin(θ/2) e₁₂

Using this rotor to rotate

You now have a rotor that can be used to go from v to u - handy!

using a vector on the left of a rotor is counterclockwise

on the right is clockwise

vR - ccw

Rv - cw

kinda logical aint it. Not? Understand that your sin points up. So no matter how the cos part behaves the sin on plane e₁₂ will always go from x to y so UP which is counterclockwise.

But if we put R LEFT of v i mean thats the mirror we flip along - isnt that ccw? Again no but for other reasons. In GA you do not multiply like in "normal" math because it does not commute. 4 3 is not the same as 3 4 here. When you multiply a plane like e₁₂ it matters.

To make it easier on you vectors will now be indexed by dim and Rotors will have memory index. So [0] is scalar cos (θ) and [1] is the sin (θ) of plane e₁₂

Remember we store the value that cos(θ) and sin(θ) evaluate to. For a normalized 45° degree rotor you can surely figure them out: Its R[(√2)/2 , (√2)/2]

Lets see what happens to our v when we use R right of it:

vR = (vₓ + vᵧ) * (R[0] + R[1])

dear god, how do you multiply this??? Remember binomial theorem and (a + b) * (c + d) ? It's the exact same thing here:

vₓ R[0] + vₓ R[1] + vᵧ R[0] + vᵧ R[1]

so these are 2 2-term and 2 3-term multiplications involved BUT you cannot add R[1] and R[2] together or vₓ and vᵧ and its the same for higher dimensional rotors.

But we know x is e₁ and y is e₂ !

Squaring axis eₙ and planes eₘₙ

eₙ always squares to the signature. you can imagine this easily with a coord systems x axis. if you take that in length 1 (e is a basis vector so always "1" as its not stretched, etc.) and use it two times to form a square - thats again just 1 x 1 saying this area will be 1.

Now in other signatures like spacetime for a certain axis this might be -1 instead. AND YOU CAN MIX!! e₁² = -1 but e₂² = e₃² = e₄² = 1!

Neat, aint it. A plane itself however like e₁₂ will ALWAYS square to -1 and the reason for that is even easier:

Imagine a plane eₓᵧ or cw eᵧₓ - no matter how if you use this 90° plane TWICE and apply it to any scalar this scalar will be flipped 180°. y = 3 will the y = -3. x = 2 will be x = -2

That's why these always square to -1. Now take a break and think about the pain of having to deal with imaginary i instead of e₁₂.

Multiplying axis with planes

How to solve e₁ * e₁₂ ? because these planes are orthonormal (normalized, perpendicular) you can always go from a plane like e₁₂ back to the geometric product of its axis. Because the cos(90°) part is always 0! and the sin(90°) e₁₂ is always 1 e₁₂!

now e₁ e₂ = (e₁ · e₂) + (e₁ ∧ e₂) this leaves only 1 e₁₂

so e₁ e₁₂ is just e₁ e₁ e₂ which we know e₁² = 1, so e₁ e₁ e₂ = e₂

flipping planes

Remember how a plane is ccw when its positive and cw when negative? Thats helpful now because what happens when you flip e₁₂ to e₂₁ ? The rotation flips! But thats not what we want! We may want to keep plane e₁₂ but rotate -90° on it! And thats the same as going e₂₁! And vica versa rotating -90° on a cw e₂₁ plane ... that's just 90° ccw on e₁₂!

So we can know: e₁₂ = -e₂₁

Thats handy because we can now solve stuff like

e₁ e₂₁ thats e₁ -e₁₂ so e₁ -e₁ e₂ = -(1)e₂

back to algebra

Knowing these we can now write the vector * rotor multiplication to axis and planes. I will keep R[0] and R[1] but add R[1]e₁₂ here because here 1 is y in 2D, but in 3D and up its not R[2] is z - but all planes numbered. In 3D a Rotor is [s, e₁₂, e₁₃, e₂₃] and in 4D its [s, e₁₂, e₁₃, e₁₄, e₂₃, e₂₄, e₃₄, e₁₂₃₄] so you can see ... x,y,z,w etc. wont hold up there much.

Use axis for vectors and nothing/scalars or planes for rotors!

(vₓ e₁ * R[0]) + (vₓ e₁ R[1] e₁₂) + (vᵧ e₂ R[0]) + (vᵧ e₂ R[1] e₁₂)

now thats better.

Here are all candidates to work on. Its simple now - but imagine in 4D - that will not be 2 * 2 terms. But ... umm many more i dono...

So first 2D, then 3D (3 * 4)

Distribute:

(vₓ e₁ * R[0]) + (vₓ e₁e₁₂ R[1]) + (vᵧ e₂ R[0]) + (vᵧ e₂e₁₂ R[1])

solve e₁e₁₂ (e₂) and e₂e₁₂ (-e₁)

(vₓ e₁ * R[0]) + (vₓ e₂ R[1]) + (vᵧ e₂ R[0]) + (vᵧ -e₁ R[1])

shuffle a bit so we get the e₁ and e₂ near each other

(vₓ e₁ * R[0]) + (vᵧ -e₁ R[1]) + (vₓ e₂ R[1]) + (vᵧ e₂ R[0])

now factor out the e axes

v' = e₁ (vₓ R[0] - vᵧ R[1]) + e₂ (vₓ R[1] + vᵧ R[0])

now thats just 2 multiplications of your vector and rotor components and thats it - a rotated v!

If you think 'hhhhmmmmm that looks familiar' thats because it is - its the rotation matrix!

cos θ, -sin θ
sin θ, cos θ

Now do it again, but in reverse!

Ok so this gives us the rotation matrix we know is ccw. Wanna do Rv to show this will be cw?

HELL YES!!!

So Rv = (R[0] + R[1]) * (vₓ + vᵧ)

R[0] vₓ + R[1] vₓ + R[0] vᵧ + R[1] vᵧ

Again we put in planes and axes

(R[0] * vₓ e₁) + (R[1] e₁₂ * vₓ e₁) + (R[0] * vᵧ e₂) + (R[1] e₁₂ * vᵧ e₂ )

Distribute. Note the e₁₂e₁ and e₁₂e₂

(R[0] * vₓ e₁) + (R[1] e₁₂e₁ vₓ) + (R[0] vᵧ e₂) + (R[1] e₁₂e₂ vᵧ)

You can already smell it - the anticommutivity of the geometric product will be different!

e₁₂e₁ = e₁ e₂ e₁ = -e₂ and e₁₂e₂ = e₁ e₂ e₂ = e₁ heresy!! its flipped!!!

(R[0] * vₓ e₁) + (R[1] -e₂ vₓ) + (R[0] vᵧ e₂) + (R[1] e₁ vᵧ)

reorder

(R[0] * vₓ e₁) + (R[1] e₁ vᵧ) + (R[1] -e₂ vₓ) + (R[0] vᵧ e₂)

factor out both axes

e₁ (R[0] vₓ + R[1] vᵧ) + e₂ (-R[1] vₓ + R[0] vᵧ)

Tadaaaa

cos(θ), sin(θ)
-sin(θ), cos(θ)

Thats a cw rotation!!

You still have not shown me how to get u so i can rotate

Thats not true, you already have everything you need - you just dont know it yet.

Because multiplying by a rotor will (after doing witchcraft / algebra on that) literally end up as an instruction to do:

- find u_para and u_perp, then do u_para - u_perp

So even though you multiply vR ... that ends up being vector_proj v onto R (u_para) - vector_perp from v onto R.

And thats it!

Build a rotor just from 1, not 2 vectors.

Imagine you want to rotate by a vector. So turn it to a rotor

Building the rotor is just like multiplying two vectors where one is the basis vector e₁ so the x-axis.

And that's just [1,0] for the second vector to multiply with.

Remember we want the second vector (u) AGAIN on the LEFT

uv  = uₓvₓ(e₁e₁) + uₓvᵧ(e₁e₂) + uᵧvₓ(e₂e₁) + uᵧvᵧ(e₂e₂)
         1            e₁e₂        -e₁e₂       1

and when thats [1,0] its simple because 2 terms (uᵧ) are already 0

uv  = vₓ + vᵧ e₁₂

now half the angle again easy - add their length. |u| is ofc 1

R = (|v| + vₓ) + vᵧ e₁₂

Build a rotor from an angle

This one is reaaally easy as

R = cos (α) + sin(α) e₁₂

Now look closely and notice theres no magnitude of a vector up front. Its there, but it's 1!

Because we want the half angle to rotate around we simple put θ/2 as the angle

R = cos (θ/2) + sin(θ/2) e₁₂

Thats all there is to it! This rotor is automatically normalized already, no need to double the length!

3D

Now you are ready to totally slash down your gimbal locked matrix multiplication 3D rotations and still dont have to deal with quaternions.

BUT while you might be now in the super cool GA clique with their not-so-obvious shibboleths and tokens of recogniton - remember talking to normies is a lifeskill.

TotallyAI

So what are quaternions actually? Remember

i² = j² = k² = ijk + -1

?

I had to learn THIS to not have gimbal locks at first:

https://eater.net/quaternions/video/stereo4d

Dude...

Going to 4D to rotate in 3D sounds super stressful to you? It totally is!

See how we can already rotate in 2D without having to introduce some weird 3rd axis and just use the 2D plane?

Well that's the same in 3D AND YOU DO NOT END UP IN 4D LIKE THE VIDEO STATES.

No 4D in 3D

Thats not how it works. We have 4 values here but these are not x y z w like in 4D its just a visualization

Current PTF

Hintergrund ändern. Verbraucht keinen oder einen 🍪.

Verknüpften Viewport öffnen

🎮 Steuerung
Dokumentation 🕹️
Sie sind leider kein Entwickler :(

Content Nodes Amount

Diligence / PTF Amount

FPS

Vertex-Count