On Fri, Aug 4, 2017 at 6:19 PM, Francesco Bonazzi <franz.bona...@gmail.com>
wrote:

>
>
> On Friday, 4 August 2017 17:34:25 UTC-4, Aaron Meurer wrote:
>>
>> You can try this, but I foresee problems reusing I=sqrt(-1) the complex
>> number as i the quaternion. Mathematically they aren't the same thing, but
>> even in terms of SymPy, ImaginaryUnit is burdened with things like
>> assumptions, which might cause issues with quaternions.
>>
>
> Implementing quaternions should be simple. Deciding how they interact with
> the rest of SymPy may be more complicated.
>

If you implement them like Ondrej suggested, as a 4-tuple, they will
interact badly. Even just adding a scalar to a quaternion will be difficult
to make work, as the scalar x would have to be converted to (x, 0, 0, 0)
first.

On the other hand, if the quaternions i, j, and k are just special
noncommutative expressions, then they will interact just fine, because
SymPy already knows how to deal with noncommutative expressions.  The only
hard thing will be making things like i**2 and i*j auto-simplify (if
desired). The former can be done with _eval_power, and the latter with Mul
postprocessors.


>
>> And maybe even you could do something with the Mul processors to make
>> them auto-simplify, if that's what is desired.
>>
>
> I would suggest an immediate evaluation in this case.
>
> Maybe a Quaternion class is the simplest way to implement quaternions.
>

What do you mean by a Quaternion class? Are you thinking something more
like my or Ondrej's suggestion?

Aaron Meurer


> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/sympy/803df12b-57f4-4f3c-a82e-f7cdbf95d9d9%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/803df12b-57f4-4f3c-a82e-f7cdbf95d9d9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6L2ZxAb1tu%3D7Uto4Y%3D-uLu0huy6Yg27D82%3D1VAXNckkWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to