Talk:Quaternion type: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 43: Line 43:


:: Hmm, there is sample pseudo-code and Python [[wp:Quaternions_and_spatial_rotation#Pseudo-code_for_rotating_using_a_quaternion_in_3D_space|here]]. --[[User:Paddy3118|Paddy3118]] 10:40, 4 August 2010 (UTC)
:: Hmm, there is sample pseudo-code and Python [[wp:Quaternions_and_spatial_rotation#Pseudo-code_for_rotating_using_a_quaternion_in_3D_space|here]]. --[[User:Paddy3118|Paddy3118]] 10:40, 4 August 2010 (UTC)

==ADA Issue?==
Hi, value r should be a floating point number rather than a quaternion without imaginary parts. If you then have to convert r to a quaternion to do the task then that should be shown. --[[User:Paddy3118|Paddy3118]] 18:21, 6 August 2010 (UTC)

Revision as of 18:21, 6 August 2010

Why a draft project?

Because I am unsure if the topic is right for RC. I tried to approach it in such a way that people could just implement what is stated in the task description without going to even the depths of the Wikipedia article. --Paddy3118 13:24, 3 August 2010 (UTC)

Just by the discussion that popped up, I think it's a worthwhile task for illustrating differences between correct imaginary and quaternary operations, and I'd think an 8-class task would be interesting (if complicated), too. (And now everyone at this GURPS session is waiting for me to pay attention.) --Michael Mol 23:01, 3 August 2010 (UTC)
It sounds interesting. Out of curiosity, can it be generalized to N real and M imaginary dimensions? ISTR there was a task that got played and adjusted to various dimension sets. I don't remember the name off-hand. (Hm. It occurs to me that we can create relationships between tasks such as "generalization of::some other task". That strikes me as an interesting direction to explore.) --Michael Mol 15:24, 3 August 2010 (UTC)
In short: no.
First, only certain values of N and M "work". Complex numbers would be N=2 and M=0 OR N=1 and M=1. Quaternions would be N=4 OR N=2 and M=2 OR N=1 and M=3 (depending on exactly what you meant by "imaginary dimensions"). But you can not do anything non-trivially useful with N=3 and M=0 (nor N=1 and M=2). To my knowledge, only 1, 2, 4 and 8 dimensions work here with this kind of arithmetic.
But also, quaternions, and other Cayley–Dickson classes of numbers, are not a full generalization of simpler numbers. Complex numbers do not have some properties which real numbers have. (For example, complex numbers can not be ordered on a line.) Quaternions do not have some properties which complex numbers have (for example quaternion multiplication is not commutative). Octonions lose some properties which quaternions have (for example: octonion multiplication is not associative). So you have to decide if you are willing to deal with the problems introduced by the additional dimensions. (And even that can be risky: I have seen too many mathematical "proofs" which assume that quaternion multiplication is commutative -- which means they are about as meaningful as proofs which assume that 0 divided by 0 is unique.) --Rdm 19:42, 3 August 2010 (UTC)
Mm. So we're talking about N and M needing to be powers of 2? (I haven't peeked at NevilleDNZ's link—no time—but that's what's coming to mind.) And that as N and M go up, the operations lose properties. Interesting and weird at the same time; it suggests to me that there's a way to linearly map a number like N or M to a property set and make prediction, but I think it ought to be getting obvious I never went very far in higher math. :-| Very, very interesting info, though. --Michael Mol 22:58, 3 August 2010 (UTC)
Actually, if we want to stick with the most obvious meanings, N=1 and M is an element of the set {0, 1, 3, 7}. That is, M must be less than 8 and must be 1 less than a positive integral power of 2. However, The Cayley-Dickson approach might let us argue about degrees of imaginaryness, and we can represent quaternions (and so on) with or without explicit use of imaginary numbers. --Rdm 01:47, 4 August 2010 (UTC)
Hi Michael, The wp article does mention Octonians, and I also read wp:Division algebra enough to know that from reals to complex to quaternions to octonians; things seem to get a little less useful. The octonians seeming to have 480 ways to multiply for example. --Paddy3118 16:28, 3 August 2010 (UTC)
I was thinking more along the lines of the kind of code generalization that would allow the same code to operate correctly on any >=0 integer value for M and N. Granted, we're delving outside a simple task. My curiosity there lies being able to learn the relationship by studying the code. --Michael Mol 18:05, 3 August 2010 (UTC)

re: Out of curiosity, can it be generalized to N real and M imaginary dimensions?

There is an interesting generalisation called Clifford algebras which contains a useful subset for Algebra of physical space and Spacetime algebra etc. eg:

  1. Special Relativity
  2. Classical Electrodynamics
  3. Relativistic Quantum Mechanics
  4. Classical Spinor

NevilleDNZ 19:24, 3 August 2010 (UTC)

What simple properties should become part of the task?

Well it seems that enough people like the draft task!

Before I remove the draft status, are their anyother simple properties of quaternions (ore fewer), that the task should ask be shown? --Paddy3118 04:24, 4 August 2010 (UTC)

This is just a personal preference, in preference to a simple 1+1=2 test I prefer - if possible - tests that are a little but more extensive.

For example for the Rational Arithmetic test:

Use the new type frac[tion] to find all perfect numbers less then 219 by summing the reciprocal of the factors.

Basically this test is nice because runs the gauntlet of multiple additions and divisions to come up with a known result.

With compl[ex] numbers such a test could be to check that exp(πi)=-1. Maybe there an equivalent for Quaternions?

NevilleDNZ 05:16, 4 August 2010 (UTC)

As I understand it, unit quaternions are used to model rotations. Perhaps using them to model some kind of rotation would do as a “demonstration” question? –Donal Fellows 07:20, 4 August 2010 (UTC)
Hmm, there is sample pseudo-code and Python here. --Paddy3118 10:40, 4 August 2010 (UTC)

ADA Issue?

Hi, value r should be a floating point number rather than a quaternion without imaginary parts. If you then have to convert r to a quaternion to do the task then that should be shown. --Paddy3118 18:21, 6 August 2010 (UTC)