Geometric algebra: Difference between revisions

Content added Content deleted
Line 1,372:
function testcliffordvector()
for i in 0:4, j in 0:4
i < j && dot(e(i), e(j)) != 0.0 && printlnthrow("Unexpected nonzero scalardot product")
if i < j
i == j if&& dot(e(i), e(j)) !== 0.0 && throw("Unexpected zero dot product")
println("Unexpected nonzero scalar product")
return
end
elseif i == j
if dot(e(i), e(j)) == 0.0
println("Unexpected zero scalar product")
end
end
end
a, b, c = randommultivector(), randommultivector(), randommultivector()
b = randommultivector()
c = randommultivector()
x = randomvector()
 
# (ab)c ≈ a(bc)
@show (a * b) * c ≈ a * (b * c)
 
# a(b+c) ≈ ab + ac
@show a * (b + c) ≈ a * b + a * c
 
# (a+b)c ≈ ac + bc
@show (a + b) * c ≈ a * c + b * c
 
# x^2 is real
isreal(x) = x[1] isa Real && all(y -> y == 0, x[2:end])
@show isreal(x * x)
 
end