enkimute / ganja.js

:triangular_ruler: Javascript Geometric Algebra Generator for Javascript, c++, c#, rust, python. (with operator overloading and algebraic literals) -
MIT License
1.52k stars 107 forks source link

Difference between ganja.js/clifford and cheat sheet for 3D PGA #104

Closed joha2 closed 3 years ago

joha2 commented 3 years ago

Hey @enkimute and @skydog23 !

Happy new year! I hope you're doing well! :smile:

I observed a difference between the cheat sheet referred on bivector.net and the outputs from clifford Python package:

for v in [e123, e023, e013, -e012]:
     print(str(v) + "* = " + str(v.dual()))
(1^e123)* = -(1.0^e0)
(1^e023)* = (1.0^e1)
(1^e013)* = -(1.0^e2)
-(1^e012)* = -(1.0^e3)

while in the cheat sheet there is no change in sign. Testing the same dualizations with the ganja.js leads to the same results like with clifford:

Algebra(3, 0, 1, ()=>
{
         console.log("e0* = " + String(!1e0));
         console.log("e123* = " + String(!1e123));
         console.log("e023* = " + String(!1e023));
         console.log("e013* = " + String(!1e013));
         console.log("e021* = " + String(!1e021));
})

leads to

e0* = e_123
e123* = -e_0
e023* = e_1 
e013* = -e_2
e021* = -e_3

Is there a typo in the cheat sheet or I am missing something (like having an old version of the cheat sheet, or different conventions between ganja.js and the cheat sheet)?

Thank you very much and best wishes Johannes

enkimute commented 3 years ago

The cheat sheet uses a different basis. (it uses e021, e013, e032, e123). This is chosen exactly so that the hodge dual only swaps signs of (all) trivector coefficients.

joha2 commented 3 years ago

Hey @enkimute! Thanks for your fast response! Sorry, I did not realize this. Sorry for my dumb questions, but I did not really understand: e021* ~ e3, e013* ~ e2, e032* ~ e1, still (where ~ means proportional to)? So is the dualization operation for ganja.js differently defined compared to the cheat sheet?

joha2 commented 3 years ago

Anyway, I will close this issue, since there is no problem with cheat sheet or ganja.js/clifford. Maybe we could discuss further questions still here, if this is OK for you.