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

1-vector/2-vector

mewertd2 opened this issue · comments

Wanted to add an example for barycentric coordinates to your tutorial section ( as suggested on bivector.net). Ran into a problem.

julia> basis"3"

julia> a = 0v1
0v₁

julia> b = 1v1
1v₁

julia> c = 1v2
1v₂

julia> ab = b-a
1v₁

julia> ca = a-c
0v₁ - 1v₂ + 0v₃

julia> bc = c-b
-1v₁ + 1v₂ + 0v₃

julia> A = -ab∧ca
1v₁₂ + 0v₁₃ + 0v₂₃

julia> bc∧ca
1v₁₂ + 0v₁₃ + 0v₂₃

julia> bc∧ca/A
ERROR: DimensionMismatch("No precise constructor for SArray{Tuple{8},Int64,1,8} found. Length of input was 3.")
Stacktrace:
[1] SArray{Tuple{8},Int64,1,8}(::Tuple{Tuple{Tuple{Tuple{Int64,Int64,Int64}}}}) at /Users/mewert/.julia/packages/StaticArrays/1g9bq/src/convert.jl:1
[2] StaticArray at /Users/mewert/.julia/packages/StaticArrays/1g9bq/src/convert.jl:4 [inlined] (repeats 3 times)
[3] macro expansion at /Users/mewert/.julia/packages/StaticArrays/1g9bq/src/convert.jl:4 [inlined]
[4] reverse(::Chain{⟨+++⟩,2,Int64,3}) at /Users/mewert/.julia/packages/Grassmann/OeTVc/src/products.jl:531
[5] ~ at /Users/mewert/.julia/packages/DirectSum/Ofduh/src/generic.jl:242 [inlined]
[6] inv(::Chain{⟨+++⟩,2,Int64,3}) at /Users/mewert/.julia/packages/Grassmann/OeTVc/src/algebra.jl:671
[7] /(::Chain{⟨+++⟩,2,Int64,3}, ::Chain{⟨+++⟩,2,Int64,3}) at /Users/mewert/.julia/packages/AbstractTensors/cHS7X/src/AbstractTensors.jl:156
[8] top-level scope at REPL[31]:1

Seems to be the zero elements

julia> A
1v₁₂ + 0v₁₃ + 0v₂₃

julia> (bc∧ca)/1v12
1.0v⃖

Yes, I'm aware of that issue, I fixed it locally a few days ago but didn't push it yet. The fix is now pushed to the master branch.

As for barycenters you can use the barycenters function on a mesh without any hassle:

julia> p,e,t = initmesh(2:0.1:8)
(Λ¹⟨++×61, Λ¹Λ¹⟨_+×61×2, I¹Λ¹⟨++×61×60)

julia> barycenters(t)

This example is for a 1 dimensional mesh, but the same function works for any dimension.

yeah, the intention for the barycentre function was to follow the suggestion on bivector.net, not to use grassmann.jl api.

Let me know what you come up with then!

Yes, I'm aware of that issue, I fixed it locally a few days ago but didn't push it yet. The fix is now pushed to the master branch.

As for barycenters you can use the barycenters function on a mesh without any hassle:

julia> p,e,t = initmesh(2:0.1:8)
(Λ¹⟨++×61, Λ¹Λ¹⟨_+×61×2, I¹Λ¹⟨++×61×60)

julia> barycenters(t)

This example is for a 1 dimensional mesh, but the same function works for any dimension.

barycenters no longer works, using the latest version of grassmann. barycenter does work though, giving 1.0v₁ + 1.0327868852459017v₂.