GithubHelp home page GithubHelp logo

Comments (18)

Orbots avatar Orbots commented on August 16, 2024 1

I haven't read the John Browne book, looks interesting though. I'll add it to my stack.

@chakravala it seems your definition of contraction in Grassmann.jl is different from the one used in Geometric Algebra. Nothing wrong with that and I don't want to get into a discussion about which one is "right".

This particular issue we are discussing here is for a Geometric Algebra library, galgebra.

The current Geometric Algebra definition of contractions should be used here, not the Grassmann Algebra/Grassmann.jl/John Browne's definition. Unless the contributers to galgebra decide otherwise.

from galgebra.

eric-wieser avatar eric-wieser commented on August 16, 2024 1

At this point I suggest we continue this conversation at the Grassman.jl repository.

The intent of this issue was to flag a potentially dangerous use of python operator overload semantics, not to question the operators of geometric Algebra.

from galgebra.

chakravala avatar chakravala commented on August 16, 2024

Grassmann.jl has < and > for contractions and <<, >> for the symmetrization (e.g. ab+ba) and anti-symmetrization (commutator ab-ba)

In my paper you can find the formula I use for converting between left and right contraction: it is simply that a<b == b>a so the left contraction is computed by switching arguments of the right contraction.

from galgebra.

eric-wieser avatar eric-wieser commented on August 16, 2024

it is simply that a<b == b>a

That directly contradicts the screenshot I took above from GA4CS, you need to apply grade reversion too

from galgebra.

chakravala avatar chakravala commented on August 16, 2024

from galgebra.

eric-wieser avatar eric-wieser commented on August 16, 2024

@chakravala, I assume then that your_lc == ga4cs_lc, but your_rc(a, b) == ga4cs_rc(a.rev(), b.rev()).rev()?

Or do neither of them align?

@enkimute, it might be worth putting a comparison of contraction definitions among your comparison cheat sheets.

from galgebra.

utensil avatar utensil commented on August 16, 2024

@eric-wieser What do you mean by if obj does not take part in the comparison?

It seems that such a rewrite won't kick in unless not both < and > are defined(for corresponding types)and it's not the case in GAlgebra. So it seems to be fine pratically, am I missing something?

from galgebra.

chakravala avatar chakravala commented on August 16, 2024

@eric-wieser well, what happened is I originally had the same GA4CS definition as you

Then @Orbots came along and opened chakravala/Grassmann.jl#27 to discuss this definition

We settled on the definition I have now. So, I don't really know what's better or correct.

I mainly rely on the right contraction, not the left contraction.

Would be good if we can get to the bottom of this.

from galgebra.

Orbots avatar Orbots commented on August 16, 2024

The issue I opened was simply that the left contraction should be the b-a grade element of the geometric product A<B == <AB>_(b-a). I didn't specify the relationship between lc and rc. I don't think the relation a<b == b>a holds in general. From the definition in the Dorst paper I referenced it doesn't.
@chakravala are you still using the hodge star to define contractions? That might be the source of the problem. I think if you want to define some "inner products" ( are contractions inner products? ) with the hodge star you should give them different names from the GA ones.

from galgebra.

chakravala avatar chakravala commented on August 16, 2024

Alright, well the original definition I used is the original Grassmann definition as discussed by John Browne in his book, which comes out as

complementhodge(a) ∨ b

which, it turns out, should be equivalent to the definition used by Dorst (but simpler in my opinion)

so, I will be switching back to the original definition for left complement, somehow I got confused when you opened that issue and I changed it, I'll go back to what I had originally

the change is now implemented in this commit chakravala/AbstractTensors.jl@6a0542e

from galgebra.

Orbots avatar Orbots commented on August 16, 2024
julia> ⋆(1v1) ∨ (1v1 ∧ 1v2)
-1v₂

Not what Dorst's left complement would give you. I didn't see a complementhodge method in my version of Grassmann.jl

AFAICT you can choose your own operator, but left and right contractions have well established definitions in geometric algebra.

From the John Browne reference (didn't read too far ) there was an inner product with an entirely different symbol which appears to be the right contraction.

https://www.researchgate.net/publication/2842332_The_Inner_Products_of_Geometric_Algebra

Screen Shot 2019-11-22 at 10 52 52 AM

one more source I found from a quick google:

Theorem 16. Let Ar and Bs be nonzero blades where r, s ≥ 1.
(a) Ar ⌋ Bs = 0 iff Ar contains a nonzero vector orthogonal to Bs .
(b) If r < s then Ar ⌋ Bs, if nonzero, is an s − r-blade representing the orthogonal complement of Ar in Bs.
` ``

<blockquote><img src="https://c5.rgstatic.net/m/426351313275430/images/favicon/favicon.ico" width="48" align="right"><div><img src="https://c5.rgstatic.net/m/42134677640462/images/favicon/favicon-16x16.png" height="14"> ResearchGate</div><div><strong><a href="https://www.researchgate.net/publication/2842332_The_Inner_Products_of_Geometric_Algebra">ResearchGate</a></strong></div><div>ResearchGate is a network dedicated to science and research. Connect, collaborate and discover scientific publications, jobs and conferences. All for free.</div></blockquote>

from galgebra.

chakravala avatar chakravala commented on August 16, 2024

Not what Dorst's left complement would give you.

Actually, it is the same result as Dorst's left complement, check with some examples below:

dorst(a,b) = ~((~b)(~a))
grassmann(a,b) = (a)b
compare(a,b) = dorst(a,b),grassmann(a,b)

now check with the compare method:

julia> compare(v1,v12)
(-1v₂, -1v₂)

The result of Grassmann is indeed the same as what @eric-wieser posted above.

I didn't see a complementhodge method in my version of Grassmann.jl

Sorry, it is Grassmann.complementrighthodge not complementhodge.

From the John Browne reference (didn't read too far ) there was an inner product with an entirely different symbol which appears to be the right contraction.

That's correct, he has the right contraction as default, as do I, but he also has the left contraction too, which turns out to be the same as Dorst's definition also, just written in a different way.

from galgebra.

Orbots avatar Orbots commented on August 16, 2024

I can see that your code is self consistent. However the math says that the left contraction of a grade 1 blade with a grade 2 blade is the grade 2-1 = 1 grade element of the geometric product between the two. So the answer should be 1v2 not -1v2.

Better to check your definitions against another lib. Here's what ganja.js says:
https://enkimute.github.io/ganja.js/examples/coffeeshop.html#OGRllEcPi

from galgebra.

chakravala avatar chakravala commented on August 16, 2024

Better to check your definitions against another lib. Here's what ganja.js says:

it looks to me more like ganja.js is not using the correct left contraction definition, instead it is using a definition which has been mis-named as the left contraction, but is actually the right contraction with its arguments swapped:

this is why I use the right contraction... because that gives you the inner product! the left contraction is another strange beast, which should not be the default (study John Browne)

also, it looks like ganja.js does not return the correct value for the right contraction (>>) either.. the result it returns for the "left contraction" is actually what the right contraction swapped should be

the definition @Orbots and @enki seems to want is the following:

right(a,b) =  a  complementrighthodge(b)
right_swapped(a,b) = right(b,a)

which is what I changed it to for him in chakravala/Grassmann.jl#27
that is the right contraction, but with arguments swapped. but the left contraction is

left(a,b) = complementrighthodge(a)  b

so @enki is also using the right contraction with arguments swapped, as @Orbots does

you seem to be confused, you are not actually using the left contraction then.

from galgebra.

utensil avatar utensil commented on August 16, 2024

This is nice to be fixed and it's a good discussion, but as an issue, we could close it now as it tracks no action.

from galgebra.

eric-wieser avatar eric-wieser commented on August 16, 2024

Reopening because I have an answer - they're not safe, we need to change them:

>>> from galgebra.ga import Ga
>>> from sympy import S
>>> g, e1, e2, e3 = Ga.build('e1 e2 e3', g=[1, 1, 1])
>>> one = g.mv(S.One)
>>> e12 = e1 ^ e2

# with sympy scalars (incorrect)
>>> [S.One < e12, S.One > e12, e12 < S.One, e12 > S.One]
[0, e1^e2, e1^e2, 0]

# with Mv instances (correct)
>>> [one < e12, one > e12, e12 < one, e12 > one]
[e1^e2, 0, 0, e1^e2]

Either that, or we have a new bug

from galgebra.

eric-wieser avatar eric-wieser commented on August 16, 2024

Turns out that bug is not relevant. However, our current design means that we cannot cooperatively dispatch the contraction methods, unlike all the other multiplication methods that can return NotImplemented:

galgebra/galgebra/mv.py

Lines 831 to 834 in 48822e7

def __lt__(self, A): # left contraction (<)
if isinstance(A, Dop):
# Cannot return `NotImplemented` here, as that would call `A > self`
return A.Mul(self, A, op='<')

galgebra/galgebra/mv.py

Lines 851 to 854 in 48822e7

def __gt__(self, A): # right contraction (>)
if isinstance(A, Dop):
# Cannot return `NotImplemented` here, as that would call `A < self`
return A.Mul(self, A, op='>')

from galgebra.

utensil avatar utensil commented on August 16, 2024

I see, that's why you said "#54 causes no visible issues, but does cause internal headaches and incompatibility with clifford". So this issue itself could be closed again?

from galgebra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.