geometryzen / davinci-newton

Experimental Physics Engine
MIT License
0 stars 1 forks source link

Implementation of inv() in 2D and 3D #3

Open SpocWeb opened 3 years ago

SpocWeb commented 3 years ago

Hi, thank you so much for StemCStudio and your videos building and explaining geometric Algebra. I discovered this technique this Summer and it is tremendously simpler and more intuitive than Tensor Algebra. This should be taught in Schools and University.

Anyway, I'm building a GA Library in C# and in seeking inspiration from your work, I've tried to implement inv() (or rcp for Reciprocal in my diction) and found your implementation interesting: You're setting up a system of linear Equations and solve it in 2^2 = 4D and 2^3 = 8D

But if I multiply the result with the original MultiVector, it does not end up with [1,0,...]. What do I miss? Here is my Code: https://www.stemcstudio.com/gists/094e494a7040255a02eb26b7df602a35

    const g3 = new Geometric3([1, 8, 7, 6, 5, 4, 3, 2])
    const inv = g3.inv()
    const shouldBeOne = g3*inv 
    const shouldBeOneToo = inv*g3 

Sorry for opening up an issue, but I don't know how to contact you otherwise. If you have a discussion board or a way to meet you in the StemCStudio Chat, I'll gladly switch to that.

Best Regards...

SpocWeb commented 3 years ago

By the way, the highly antisymmetric Nature of the geometric Product yields a very easy Reciprocal in R²: (s,-x,-y,-I)/|mv|² the so-called Clifford-Conjugate Unfortunately this doesn't seem to be the case in R³.

stemcstudio commented 2 years ago

SpocWeb. No worries contacting me here. I would have to check the implementation to see if I am trying to solve the general case or whether I am solving particular special cases. The general case is solved by converting to an equivalent linear algebra problem of solving A * x = b. I have done this elsewhere, but I am not sure if I am doing it here. I don't have the bandwidth to check this right now but I will take a look when I can. Feel free to dig in.

SpocWeb commented 2 years ago

I was a bit too optimistic for the Reciprocal. Only for (Pseudo-) Vectors (i.e. 1st Level and n-1 Level) the Formula works, but that may be an important case: v*v/|v|² so Inv(v) = v/|v|² I think it would be worthwhile to implement that as a special case.