-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
added 7 dimensional cross product #32107
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
Conversation
|
What should be my next steps? |
|
I would:
Also: Welcome, and thanks for the contribution! |
|
This is neat, but would anyone use this in practice? I hesitate to merge code unless there is a realistic application in mind. Who would be happy with code that works in 3 or 7 dimensions but not any other dimensions? |
|
@ararslan I'll add the things in a couple of days. @stevengj Cross product is defined only in 3 and 7 dimensions. I know it's weird. |
|
I wonder if this is better to put into a package. (I wonder which one). |
|
@adamnemecek, I know that. But just because it can be defined in 7 dimensions doesn't automatically mean that we should include the code — it depends on whether it is useful. The 3-dimensional cross-product is useful because we live in 3 dimensions and so lots of people do computations with this product in practice. On the other hand, any code that wants to handle 7 dimensions probably either
|
|
@ViralBShah I thought about that but there's no way to overload a function based on array size. @stevengj You are correct, I'd like to use it for implementation of octonions. However I need a custom octonion implementation for one reason or another. I still feel like it makes sense to add 7 dim cross product, just for the sake of completeness. |
|
Since it is not unique, why choose this one? |
|
Whats not unique. |
|
There is not "the" seven dimensional cross product. |
|
https://en.wikipedia.org/wiki/Seven-dimensional_cross_product:
|
|
OK if someone needs a different one they can deal with that. This one is more commonly used than the others. |
|
Do you have a reference for that? |
|
Is it going to change things If I provide a different one? |
|
It might. If there's one unique preferred cross product in seven dimensions, then that's a decent argument for "well, we might as well have it compute that". For three dimensions, there are two cross products that differ only by sign, and one of those is the standard by convention. I know squat about seven dimensional cross products, but from reading that wikipedia page, the non-uniqueness makes me very reluctant to bake an arbitrary choice in that may or may not be standard. If you can make a convincing case that it is actually standard, that's much more compelling. |
|
The implementation I went with is the one from wiki. I can take the one from the julia implementation of octonions. I think it makes sense to pick one and be consistent. |
|
The wikipedia page gives at least two different definitions. |
|
Do you like any of the other ones better? |
|
In any case the docstring needs to explain clearly which cross product is given. I don't know what the most compact form would be. Multiplication table? |
|
OK, I'll add a docstring if I know this will get merged once it's polished. |
I'm afraid that's not how it works in the base language. We are not trying to be difficult or argumentative here—by accepting an API in the language, we are committing to it essentially forever. You may well forget about this PR or that you ever worked with seven dimensional cross products in a few years, but I'll be here answering questions about why we chose to implement this particular cross product for decades to come. Before more work is put into this, it should be determined whether there is one standard cross product that it makes sense to bake into the language forever. If not, then this definition belongs in a package which has much more leeway to be opinionated since people can choose which packages they use. |
|
Imma close it. |
If there is something wrong with the type in Quaternions.jl please file an issue there or make a PR. |
|
Nothing is wrong with it, I'm trying to implement some clifford algebras and I'd like to able to declare say dual sedenions by composing already existing types. I was attempting something yesterday that required the cross product to be defined for also 1 and 7 dimensions. Ive abandoned that approach since then. I checked if julia does the 7 dim cross product and thought it was a simple contribution. |
|
Thank you for the PR. I definitely learnt something new here! |
It's a nice to have.