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

Universal pseudoscalar I and × cross product #10

Merged
merged 2 commits into from
Mar 2, 2019
Merged

Conversation

chakravala
Copy link
Owner

As pointed out in the literature cited by @Orbots in #5 there is an interest in a generalized notation for the pseudoscalar quantity, sometimes written as i or I by various authors.

In this pull request, the goal is to debate and discuss the interpretation of I or -I with its signed value.

As it happens, I is also defined in Julia's LinearAlgebra library

help?> I
search: I IO if Int in im Inf isa Int8 inv Int64 Int32 Int16 imag Inf64 Inf32 Inf16 Int128

  I

  An object of type UniformScaling, representing an identity matrix of any size.

and it is a UniformScaling type in general

help?> UniformScaling
search: UniformScaling

  UniformScaling{T<:Number}

  Generically sized uniform scaling operator defined as a scalar times the identity operator,
  λ*I. See also I.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> J = UniformScaling(2.)
  UniformScaling{Float64}
  2.0*I
  
  julia> A = [1. 2.; 3. 4.]
  2×2 Array{Float64,2}:
   1.0  2.0
   3.0  4.0
  
  julia> J*A
  2×2 Array{Float64,2}:
   2.0  4.0
   6.0  8.0

This pull request implements an interpretation of UniformScaling as a universal pseudoscalar element, which in correspondence with the new version of AbstractTensors.jl v0.1.4 just released enables full algebraic interoperability of UniformScaling and I as a universal pseudoscalar.

function (V::VectorSpace)(s::UniformScaling{T}) where T
    SValue{V}(T<:Bool ? (s.λ ? -(one(T)) : one(T)) : s.λ,getbasis(V,(one(Bits)<<ndims(V))-1))
end

There is one question about it however; because the value of I is by default a signed interpretation

julia> I
UniformScaling{Bool}
true*I

as you can see, the default I holds a Bool sign value of true, thus I have also taken the liberty of defining the default signed I as having a minus sign attached to it.

The advantage of defining the signed I with its signed interpretation is that it helps with hyperplanes

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

julia> i,j,k = I*v1, I*v2, I*v3
(-1v₂₃, 1v₁₃, -1v₁₂)

julia> i^2, j^2, k^2, i*j*k
(-1v, -1v, -1v, -1v)

where the multiplication on the left by I*x has the effect of -complementright(x).

This is then also useful for making the generalized definition of cross product

×(a,b) = I*(ab)

which also requires a negative sign interpretation (here already built-in).

This sign value might be confusing to some onlookers though, who are not familiar with the sign value associated to the UniformScaling and how it is interpreted in geometric algebra.

What do you think is the best interpretation of it here? I think the sign value is a good way to interpret it.

requesting feedback from @enkimute @arsenovic @hugohadfield

@codecov-io
Copy link

codecov-io commented Feb 27, 2019

Codecov Report

Merging #10 into master will decrease coverage by 0.49%.
The diff coverage is 10.63%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #10     +/-   ##
=========================================
- Coverage   24.19%   23.69%   -0.5%     
=========================================
  Files           7        7             
  Lines        1236     1266     +30     
=========================================
+ Hits          299      300      +1     
- Misses        937      966     +29
Impacted Files Coverage Δ
src/Grassmann.jl 59.37% <ø> (ø) ⬆️
src/multivectors.jl 17.24% <ø> (ø) ⬆️
src/symbolic.jl 16.32% <0%> (-3.19%) ⬇️
src/algebra.jl 14.79% <16.12%> (-0.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bd9920...0646f8c. Read the comment docs.

@Orbots
Copy link

Orbots commented Feb 27, 2019

You already have the pseudo scalar represented as the highest grade basis vector. e.g. v123 in <+++>. Which I like using since it's quite clear what it is. I looks nice though. You need to be careful because the product of a multivector and I only commutes in odd dimensional algebra. vI = (-1)^(n*(n-1)/2)Iv.

The sign of I should be positive. The generalized cross product is the dual of the wedge product. I'm defining "dual" as multiplication by the inverse of the pseudoscalar. In <+++> I⁻¹ = -I, which is why UniformScaling{false} works out for the cross product formula in 3D. Since I*I⁻¹ = 1 we can use reverse(I) = I⁻¹ The generalized cross product that works for all dimensions should be ×(a,b) = (a∧b)*reverse(I)

@Orbots
Copy link

Orbots commented Feb 27, 2019

aside from a more explicit representation of the pseudoscalar I'd like to see a operator for the geometric algebra dual, which is ( up to a sign ) the Hodge Dual. Could look like this:
⋆(a) = a*(reverse∘last∘collect)(V)

which gives you the quaternion basis

julia> i,j,k = ⋆(v1), ⋆(v2), ⋆(v3)
(-1v₂₃, 1v₁₃, -1v₁₂)

@Orbots
Copy link

Orbots commented Feb 27, 2019

I may be mixing some stuff up here. I have to admit to being a little confused on the difference and relationships between the geometric dual, involutions, orthogonal complements, conj, etc.

@chakravala
Copy link
Owner Author

chakravala commented Feb 27, 2019

This pull request also defines this new function

hyperplanes(V::VectorSpace{N}) where N = map(n->I*getbasis(V,1<<n),0:N-1)

which does basically what your Hodge star does

julia> hyperplanes(ℝ^3)
3-element Array{SValue{⟨+++⟩,2,B,Int64} where B,1}:
 -1v₂₃
 1v₁₃ 
 -1v₁₂

so that will be available after I merge this (here I still used the other interpretation of sign)

Alright, so I == v123...n for the pseudoscalar, so that the true is interpreted as being a positive.

Then the Hodge star can map to a single element, because I don't believe it returns a set.

@Orbots
Copy link

Orbots commented Feb 27, 2019

The GA form of the hodge star operator there takes a blade with grade (n-r) and returns a blade with grade r. That's for another pull request I figure. Cheers.

@chakravala
Copy link
Owner Author

chakravala commented Feb 27, 2019

Not sure if you are aware of complementright and complementleft operations and are already defined on the current branch, but here I just have const ⋆ = complementright at the moment:

julia> complementright(v13)
-1v₂

julia> (v13+v12)
0v₁ - 1v₂ + 1v₃

This is on the current release of Grassmann already defined

julia> (v1+v2+v3)
1v₁₂ - 1v₁₃ + 1v₂₃

should it be the negative of the complementright then?

@Orbots
Copy link

Orbots commented Feb 27, 2019

I had seen the complementleft/right methods. I hadn't noticed the star operator since with a small font it looks like ⋅ unless you squint |-) That's great.

What is the definition of complementleft and right? I appears to be the effect of mulitplying ( via geometric product ) with the pseudoscalar from left or right side. What is the source material you are pulling from most often?

The differences between Grassmann, Clifford, exterior and Geometric Algebra can be pretty subtle. For the GA dual ( on a versor: https://en.wikipedia.org/wiki/Geometric_algebra#Versor ) would use complementleft. The hodge star is closer to Grassmann algebra than GA isn't it? It could be they differ by a sign. You do need a scale there though for it to really be a hodge star ( norm of the metric )?

However you define it is fine with me as there should be a simple isomorphism to whatever form of exterior product enhanced algebra the user wants.

@chakravala
Copy link
Owner Author

chakravala commented Feb 28, 2019

Definition of complementleft(x) is an element such that pseudoscalar I == complementleft(x) ∧ x and the complementright(x) is likewise pseudoscalar I == x ∧ complementright(x). This is a definition as discussed in #3 where I cited paper that discusses Lengyel's product definitions and also the book writen by John Browne on Grassmann algebra. All of my relevant sources are too many to name here.

It turns out that this definition of complement is same as multiplying by a pseudoscalar on left or right.
However, the definition is only the same when metric is ignored. Then it is like Hodge.

julia> (Λ(V"-+++").v1), (Λ(V"++++").v1)
(-1v₂₃₄, v₂₃₄)

I also mentioned about the Hodge dual in issue #2 and in this case the norm of metric would be ±1 and the Hodge dual should be made up of a product of the metric signs and in fact my definition of complement also takes the metric like this also into account.

So my definition of complementleft and complementright is actually a mix of complement and Hodge.

julia> Λ(V"-+++").v1  complementright(Λ(V"-+++").v1)
-1v₁₂₃₄

Which means that the Hodge star / complementright are not really the same thing? Since now this is actually the negative of the complement, and not the complement itself?

Should the complement and Hodge definitions be separated? There are two aspects we are discussing, there is the complement and there is the additional sign change with metric.

@Orbots
Copy link

Orbots commented Feb 28, 2019

My primary reference for GA is: http://www.faculty.luther.edu/~macdonal/laga/

Ok, I see. I've only really be thinking of "+" basis vectors. Where the metric is trivial. Not sure all the dual properties hold in non-"+" spaces. i.e. |dual(A)| == |A|.
In that setting I've been using the idea of the using the inverse of the pseudoscalar to define the dual. dual(A) = A*I⁻¹. In general, then we need to find an I⁻¹ s.t. I*I⁻¹ = 1.0 With the "+" basis I⁻¹ = reverse(I)/|I|. Maybe this can be used for other basis types? With this then you can get relationships between inner and outer products equivalent to using the regressive product. dual(A⋅B) = A ∧ dual(B). Can the idea of finding an appropriate I⁻¹ whose right product with a multi vector gives you the dual help find the correct answers?

That's all I got 😃 Not sure I can constructively comment until I've read a bit more. I am keen on seeing non-trivial metrics sorted out though as I have some applications I'd like to explore with dual quaternions ( degenerate metric ).

@chakravala chakravala merged commit 3e7b1b8 into master Mar 2, 2019
@chakravala
Copy link
Owner Author

The complementright has now been renamed to complementhodge and is now replaced with a separate function which is the complement without the metric sign. Thus complementhodge is the standard Hodge and then there are also complementleft and complementright separately (without metrics).

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

Successfully merging this pull request may close these issues.

3 participants