Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deviation between MultiVector and MVArray calculation #426

Open
joha2 opened this issue Jul 24, 2023 · 0 comments
Open

Deviation between MultiVector and MVArray calculation #426

joha2 opened this issue Jul 24, 2023 · 0 comments

Comments

@joha2
Copy link

joha2 commented Jul 24, 2023

Hey guys!

First of all: Thank you very much for this library! It helped me a lot discovering GA 😄
I think I found a bug, because there is a discrepancy between the calculation with MultiVectors and with MVArrays. The chosen algebra is PGA in 3D with e0*e0 = 0.

My minimal working example code is the following:

import numpy as np
from clifford import Cl
import clifford

lpga3d, bpga3d = Cl(p=3, q=0, r=1, firstIdx=0)
Ipga = lpga3d.pseudoScalar

e0, e1, e2, e3 = lpga3d.basis_vectors.values()

print("Clifford version: ", clifford.__version__)
print("I = ", Ipga)
print("---------------")
a = e0 + 2*e1+3*e2+4*e3
aI = a*Ipga
scpaI = a|Ipga

print("a = ", a)
print("a*I = ", aI)
print("a|I = ", scpaI)
print("---------------")
b = np.ones(1, dtype=int)*(1*e0 + 2*e1 + 3*e2 + 4*e3)
bI = b*Ipga
scpbI = b|Ipga

print("b = ", b)
print("b*I = ", bI)
print("b|I = ", scpbI)
print("---------------")

The output is given by

Clifford version:  1.4.0
I =  (1^e0123)
---------------
a =  (1^e0) + (2^e1) + (3^e2) + (4^e3)
a*I =  -(4^e012) + (3^e013) - (2^e023)
a|I =  -(4^e012) + (3^e013) - (2^e023)
---------------
b =  [(1^e0) + (2^e1) + (3^e2) + (4^e3)]
b*I =  [-(4^e012) + (3^e013) - (2^e023)]
b|I =  [(4^e012) - (3^e013) + (2^e023)]
---------------

From an analytical point of view a^I = 0 since I has the highest grade.
I think the values for a are correct, but the scalar product b|I is wrong.

Is this a bug or did I do something wrong?

Best wishes
Johannes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant