Geometric algebra: Difference between revisions

Content added Content deleted
Line 1,371: Line 1,371:


function testcliffordvector()
function testcliffordvector()
allorthonormal = true
for i in 0:4, j in 0:4
for i in 0:4, j in 0:4
i < j && dot(e(i), e(j)) != 0.0 && throw("Unexpected nonzero dot product")
i < j && all(iszero, e(i) * e(j)) != 0.0 && (allorthonormal = false)
i == j && dot(e(i), e(j)) == 0.0 && throw("Unexpected zero dot product")
i == j && !all(iszero, e(i) * e(j)) == 0.0 && (allorthonormal = false)
end
end
println("e(i) * e(j) are orthonormal for i, j ϵ [0, 4]: ", allorthonormal)
a, b, c = randommultivector(), randommultivector(), randommultivector()
a, b, c = randommultivector(), randommultivector(), randommultivector()
x = randomvector()
x = randomvector()
Line 1,385: Line 1,388:
@show isreal(x * x)
@show isreal(x * x)
end
end



testcliffordvector()
testcliffordvector()
</lang>{{out}}
</lang>{{out}}
<pre>
<pre>
e(i) * e(j) are orthonormal for i, j ϵ [0, 4]: true
(a * b) * c ≈ a * (b * c) = true
(a * b) * c ≈ a * (b * c) = true
a * (b + c) ≈ a * b + a * c = true
a * (b + c) ≈ a * b + a * c = true