chakravala / Grassmann.jl

⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra

Home Page:https://grassmann.crucialflow.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug ?] repeated wedge product causes weird out of bounds error

TsurHerman opened this issue · comments

commented
using Grassmann
using LinearAlgebra
@basis "1,1,1,0"

#plane in PGA3D
p(a,b,c,d) = a*v1+b*v2+c*v3+d*v4

p(rand(4)...) ∧ p(rand(4)...) ∧ p(rand(4)...)
ERROR: BoundsError: attempt to access (0.056553186254344245, 0.1745024077597439, 0.18635761649535065, 0.2928144966538575)
  at index [5]
commented

probably related to some terms ending really close to zero but not exactly zero

Fixed the error just now on my laptop, but need to sort through some other uncommitted changes before I make a new commit.

commented

Another thing to consider is forcing exact zero on + and - operations even if it is approximately zero.
something along the lines of
-(A,B) = isapproax(A,B) ? 0 : A-B
to avoid numeric noise

The issue is now resolved in the newly released Grassmann v0.7

julia> p(rand(4)...)  p(rand(4)...)  p(rand(4)...)
-0.15962007097893383v₁₂₃ + 0.42424099192478193v₁₂₄ - 0.039856749816011006v₁₃₄ - 0.598826026062381v₂₃₄