Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding basis vector to multivector changes multivector #16

Closed
karlwessel opened this issue May 27, 2019 · 4 comments
Closed

Adding basis vector to multivector changes multivector #16

karlwessel opened this issue May 27, 2019 · 4 comments
Labels

Comments

@karlwessel
Copy link

When I add two multivectors A and B everything works like expected:

julia> using Grassmann

julia> @basis "2"
(⟨++⟩, v, v₁, v₂, v₁₂)

julia> A = 2v1 + v2
2v₁ + 1v₂

julia> B = v1 + v2
1v₁ + 1v₂

julia> A + B
3v₁ + 2v₂

julia> A
2v₁ + 1v₂

julia> B
1v₁ + 1v₂

However when I add one of the basis vectors (v1 or v2) that are not orthogonal to the multivector, it changes the multivector:

julia> v1 + A
3v₁ + 1v₂

julia> A
3v₁ + 1v₂

julia> v1 + A
4v₁ + 1v₂

julia> v1 + A
5v₁ + 1v₂
@chakravala
Copy link
Owner

chakravala commented May 27, 2019

Alright, I have fixed the bug on master branch, looks like I forgot to add the copy command after making some other changes to my code recently when I introduced the bcast method to my code.

This will be released as part of v0.1.6 in the near future, after adding some more changes.

Also, I recommend basis"2" over @basis "2" if you are using a string.

@karlwessel
Copy link
Author

Alright, I have fixed the bug, looks like I forgot to add the copy command after making some other changes to my code recently when I introduced the bcast method to my code.

Works now, thanks for the quick fix!

Also, I recommend basis"2" over @basis "2" if you are using a string.

Ok, will do. I took that kind of style from your runtests.jl

@karlwessel
Copy link
Author

It seems like the problem is not completely fixed yet, since i get the same problem when adding an MBlade to a MultiVector:

julia> using Grassmann

julia> basis"2"
(⟨++⟩, v, v₁, v₂, v₁₂)

julia> a = v1 + v2
1v₁ + 1v₂

julia> A = v + v1
1 + 1v₁

julia> typeof(a)
MBlade{Int64,⟨++⟩,1,2}

julia> typeof(A)
MultiVector{Int64,⟨++⟩,4}

julia> a+A
1 + 2v₁ + 1v₂

julia> a+A
1 + 3v₁ + 2v₂

@karlwessel
Copy link
Author

Now everything works, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants