Symbolic ExampleΒΆ

[1]:
from kingdon import Algebra

Let us create two symbolic vectors u and v.

[2]:
alg = Algebra(3, 0, 1)
u = alg.vector(name='u')
v = alg.vector(name='v')

Their product is a bireflection, and has a scalar and bivector part:

[3]:
R = u * v
print('R =', R)
print('grades:', R.grades)
R = (u1*v1 + u2*v2 + u3*v3) + (u0*v1 - u1*v0) πžβ‚€β‚ + (u0*v2 - u2*v0) πžβ‚€β‚‚ + (u0*v3 - u3*v0) πžβ‚€β‚ƒ + (u1*v2 - u2*v1) πžβ‚β‚‚ + (u1*v3 - u3*v1) πžβ‚β‚ƒ + (u2*v3 - u3*v2) πžβ‚‚β‚ƒ
grades: (0, 2)

While the product of two different vectors has a non-zero bivector part, the product of a vector with itself only has a scalar part:

[4]:
usq = u * u
print('usq =', usq)
print('grades:', usq.grades)
usq = (u1**2 + u2**2 + u3**2)
grades: (0,)

Kingdon has realized this, and has removed the bivector part in the output entirely, and not just set it equal to zero.

To evaluate this square for given numerical values of the coefficients, we can call the symbolic expression:

[5]:
import numpy as np

res = usq(u1=np.cos(np.pi/3), u2=np.sin(np.pi/3), u3=0)
res
[5]:
1.0
[ ]: