Skip to content

elaborated on Grassmann.jl quaternions#95

Merged
KronosTheLate merged 10 commits intoJuliaPackageComparisons:mainfrom
chakravala:patch-1
May 3, 2024
Merged

elaborated on Grassmann.jl quaternions#95
KronosTheLate merged 10 commits intoJuliaPackageComparisons:mainfrom
chakravala:patch-1

Conversation

@chakravala
Copy link
Copy Markdown
Contributor

Feel free to change the examples I provided in the pull request, this is just a template you can expand on if you want.

@KronosTheLate
Copy link
Copy Markdown
Contributor

I have to admit, this is above my paygrade. I am unable to assess the content. With that said, my inclination is to just merge it, given that it is written by someone more knowledgable than me.

I have two minor immediate concerns:

Firstly, it that it seems like your additions provide a lot of information, and some of it is theoretical knowledge about quaterions. Is all of it required to highlight the differences between the packages ?

Second, if this PR is merged, then the amount of text about Grassmann will be significantly larger than for the others. Would you be able to bring them more in line? By fleshing out the others a bit, and perhaps trimming the new content down. Remember, the goal is to guide a user looking to use quaternions to the right package. For that goal, the most important thing is to show the ease-of-use, capabilities and perhaps performance of the respective packages.

Remember, details about the full abilities of each package are better left for the respective documentations. We are only interested in what one package can do, that another can not.

I would completely understand if you are primarily concerned with representing Grassmann.jl, as you are the developer of it. I am only asking because I am unable to write about this myself, so I can not fix it up at a later point. I am therefore taking the liberty to be a little demanding. In any case, I am very happy for your contribution!

@chakravala
Copy link
Copy Markdown
Contributor Author

I have to admit, this is above my paygrade

my paygrade as a free software developer on Grassmann.jl is zero, so you must be in the negative based on that claim

will be significantly larger than for the others.

Yes, I understand the concern, I thought it might be an issue, but I just wanted to quickly write something without thinking about it a whole lot at first.

I will refine this pull request later today

@mxfactorial
Copy link
Copy Markdown

trimming the new content down

code comments coach brevity

julia> using Grassmann; basis"3" # create grassman elements
(⟨×××⟩, v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)

julia> s,i,j,k = v,v12,-v13,v23 # assign quaternion
(v, v₁₂, -1v₁₃, v₂₃)

julia> i*j == k # test structure
true

julia> quatvalues(s+2i+3j+4k) # exported function accepts quaternion signature
4-element StaticVectors.Values{4, Int64} with indices SOneTo(4):
 1
 2
 3
 4

@chakravala
Copy link
Copy Markdown
Contributor Author

chakravala commented Apr 24, 2024

Quaternion algebra exists as a specialized sub-algebra within a more general Grassmann geometric algebra, where the goal is to seamlessly transition between quaternion abstractions and further combinatorial generalizations. There are several ways to assign i,j,k with Grassmann elements, perhaps the standard would be i = v12, j = -v13, k = v23 (although this is not a unique choice). Since j and v13 have opposite sign in this notation, the quatvalues method is exported to output the coefficients with the sign convention of s,i,j,k.

  • assign Grassmann elements for quaternion usage: using Grassmann; basis"3"
  • combinatorial basis: v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃ or v, v1, v2, v3, v12, v13, v23, v123
  • assign quaternion basis: s, i, j, k = v, v12, -v13, v23 could be a standard choice
  • quatvalues(::Quaternion) returns the coefficient values according to the s, i, j, k standard
  • quaternion(s,i,j,k) returns the Grassmann quaternion from the s, i, j, k standard

Converting a quaternion operator R on a three dimensional vector to a matrix (with the x⊘R evaluation) can be done with Matrix(operator(R)) for convenience.

julia> Matrix(operator(exp(v12*π/8)))
3×3 Matrix{Float64}:
 0.707107  -0.707107  0.0
 0.707107   0.707107  0.0
 0.0        0.0       1.0

As a result of the framework of geometric algebra implemented in Grassmann, vector algebra and quaternion algebra are compatible in a unified formalism. Given a quaternion operator R and a vector x the operator can be applied with either the R>>>x (evaluated as R*x*conj(R) operator) or x⊘R (evaluated as conj(R)*x*R operator) to transform vectors with quaternions.

@chakravala
Copy link
Copy Markdown
Contributor Author

If that's still too long, the matrix conversion example can be removed.

@chakravala
Copy link
Copy Markdown
Contributor Author

Deleted the last code snippet example and replaced it with this:

Comparison of quaternions in the context of Grassmann to other quaternion implementations is characterized by syntax design differences to fit into a larger mathematical formalism. Differences such as performance or edge cases can always be smoothed out, while syntax and design choices are fundamentally different.

This pull request is ready to be merged, if nobody has anything else to contribute as of now @KronosTheLate @hyrodium

@KronosTheLate KronosTheLate added the ok to preview Trigger CI job for preview deployment label Apr 28, 2024
@github-actions
Copy link
Copy Markdown

Document generation succeeded!
Preview site will be available at https://juliapackagecomparisons.github.io/preview/PR95 after github-pages deployment🚀

@chakravala
Copy link
Copy Markdown
Contributor Author

Made one last commit deleting 2 words from the list items to fit into the column formatting of the preview website.

@KronosTheLate
Copy link
Copy Markdown
Contributor

This looks good!

I am only missing one sentence in the start of the section. Something like "Grassman.jl can fully replace Quaternions.jl. The syntax is somewhat more verbose and general."

Or "Grannman.jl is not a replacement for Quaterions.jl. The packages have different goals, and if you only intend to work with quaternions, then Quaterions.jl is likely simpler to use. Quaterions.jl also has equal or better performance, better support for automatic differentiation, and more edge-cases covered compared to Grassman.jl' imolementation of quaternions."

As you can see, the conclusion could go either way, I am not sure. But just a sentence about if the package overlap completely or partially in their quaterions capabilities, and what is reccomended for users looking to just use quaterions.

@chakravala
Copy link
Copy Markdown
Contributor Author

@KronosTheLate you are basically asking me for my own bias opinion, which I tried to leave out, but now it is included

In the traditional quaternion packages there is only access to a very limited mathematical scope, which is similar to being color blind or unable to see more colors. This developer (for example), will feel a loss of color vision to downgrade from Grassmann to a more limited quaternion formalism, so the comparison is similar to choosing between being color blind or not. Of course, programming using a much more genreal and sophisticated mathematical formalism involves an increased level of cognition, which perhaps not everyone may be immediately willing to extend awareness or compatibility to.

@KronosTheLate
Copy link
Copy Markdown
Contributor

I take your point. Writing these comparisond will have to be a balance between representing objective truth, and being specific enough to be useful.

With that said, I do not believe that the analogy to being color blind is something that really helps people choose. I also suspect that it is unfair to Quaterions.jl to compare it with colorblindness, just due to the immediate negative connotations. Language like "more limited in scope" is both easier to understand and more useful.

I think I will attempt to write something myself that I believe will be of more help. The gist of it will be that Grassman.jl can to everything that pure quaternion packages can do, but that the syntax is more verbose and abstract, due to being part of a larger formalism.

@chakravala
Copy link
Copy Markdown
Contributor Author

@KronosTheLate I have made another commit to change the color blindness terminology to imaging technology terminology, since it's more accurate to speak about a choice of technology than a biological predicament

@KronosTheLate
Copy link
Copy Markdown
Contributor

Thanks, that is much better. I made one final adjustment to it: The "black-white" analogy is stille quite favourable towards Grassman.jl. I therefore took the liberty to be more negative in the sentence bout the negative aspects, writing that the syntax will be more abstract and verbose. I feel like that strikes a good balance in being positive in expressing the pros, and more negative in expressing the downsides, which helps me a lot in getting a feeling for the tradeoffs. If you are happy with that change, I will merge this ^_^

@chakravala
Copy link
Copy Markdown
Contributor Author

It's not the verbiage I would use, but doesn't conceptually conflict with the original meaning, so you can merge it if you want.

Comment thread docs/comparisons/math/quaternions.md Outdated
Comment on lines +81 to +82
In the traditional quaternion packages there is only access to a very limited mathematical scope, which is similar to black and white images instead of full color.
This developer (for example), will feel a loss of mathematical expressibility when downgrading from `Grassmann` to a more limited quaternion formalism, so the comparison is similar to choosing between black and white or full color image technology.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand these sentences. Could you provide some concrete code examples to illustrate the "color" of Grassmann.jl? The analogy of black and white versus full color doesn't quite clarify the advantages for those unfamiliar with Grassmann.jl.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grassmann.jl has more colors because it is built on the full exterior algebra basis of Grassmann algebra, which encompasses far more than just quaternions in three dimensions. With Grassmann.jl you can generalize quaternions to any lower or higher dimensions, and not only does it support generalization of quaternions, it also supports reflections and not only rotations, it supports projective geometry and other kinds of geometrical transformations other than pure rotations that quaternions are enabling. So with Grassmann you get a full color vision, while with a pure quaternion package you are only limited to something like black and white colors.

Copy link
Copy Markdown
Contributor Author

@chakravala chakravala Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analogy of black and white versus full color doesn't quite clarify the advantages for those unfamiliar with Grassmann.jl.

Think of it like this: if you only know pure quaternions, then it is as if you can only see in black and white. You are unable to perceive that there are more colors that exist, so you cannot fathom what kind of an upgrade Grassmann.jl is without upgrading your cognition. After you learn lots of mathematics, you will eventually understand that pure quaternion packages are like black and white technology when compared with full color Grassmann.jl

@chakravala
Copy link
Copy Markdown
Contributor Author

@hyrodium I've converted the analogy into a more direct comparison to avoid ambiguity

In the traditional quaternion packages there is only access to a limited mathematical scope constrained to rotations in three dimensions, while in Grassmann there are rotational algebras for lower and higher dimensions and it is also natural to deal with reflection operator compositions and more. This developer (for example), will feel a loss of mathematical expressibility when downgrading from Grassmann to a more limited quaternion formalism, as Grassmann can express the full graded algebra structure compared to the mere sub-algebra of quaternions.

Hopefully this completes the pull request for now.

@chakravala
Copy link
Copy Markdown
Contributor Author

Let's finish this, you can reference me with @chakravala if there's more discussion in the future.

@KronosTheLate KronosTheLate merged commit d442dc8 into JuliaPackageComparisons:main May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok to preview Trigger CI job for preview deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants