1 | initial version |
After hacking away at this for a day or so, I can start answering some of my own questions. One reason why I didn't have answers right away is due to the fact that the automatically generated documentation for the quaternions does not cover the methods in the parent class nor does it cover several external functions that still work against the quaternion object.
The other problem is that I am not an algebraist. So for example the fact that the scalar part is actually half the reduced trace was not readily obvious. So here is my take so far on my "issues".
1) Let q be an instance of a quaternion. q.reduced_trace()/2 is the scalar part. But even better is the undocumented fact that the [] operator has been overloaded so that you can simply do q[0]. That latter is a nice feature. Once you have that generating the "vector part" is easy enough.
2) Another undocumented feature is the .C method for matrices and the .conjugate() method which appears to exist for both quaternions and matrices. However it only gives you the quaternion conjugation not the elementwise complex conjugation. The latter has to be added by the programmer as far as I can tell.
As for the other automorphisms like involution and reversion, they would have to be implemented by the programmer as far as I can tell. I suspect the same might be true for the more general Clifford algebras, but I'm not certain.
3) I'm stuck with this for now. Maybe there are undocumented constructors somewhere.
4) Well quaternions can not be elements of a vector, but it can be elements of a matrix! Whoo Hoo! Something like
mat12 = matrix([q1,q2])
will actually create row matrix from two quaternions. Now I can implement the direct sum of two biquaternions, which is the odd degenerate space I have to work with. I guess someone forgot or didn't see the need to implement a _vector_ method.
Just one more comment:
The performance of symbolic quaternions is actually pretty good. In timing tests it's about 10 times faster than embedding it in the isomorphic Clifford algebra within Sage and about 30 times faster than my Matlab/Mupad implementation. Of course the latter uses symbolic matrices, which forces the duplication of symbolic elements.
2 | No.2 Revision |
After hacking away at this for a day or so, I can start answering some of my own questions. One reason why I didn't have answers right away is due to the fact that the automatically generated documentation for the quaternions does not cover the methods in the parent class nor does it cover several external functions that still work against the quaternion object.
The other problem is that I am not an algebraist. So for example the fact that the scalar part is actually half the reduced trace was not readily obvious. So here is my take so far on my "issues".
1) Let q be an instance of a quaternion. q.reduced_trace()/2 is the scalar part. But even better is the undocumented fact that the [] operator has been overloaded so that you can simply do q[0]. That latter is a nice feature. Once you have that generating the "vector part" is easy enough.
2) Another undocumented feature is the .C method for matrices and the .conjugate() method which appears to exist for both quaternions and matrices. However it only gives you the quaternion conjugation not the elementwise complex conjugation. The latter has to be added by the programmer as far as I can tell.
As for the other automorphisms like involution and reversion, they would have to be implemented by the programmer as far as I can tell. I suspect the same might be true for the more general Clifford algebras, but I'm not certain.
3) I'm stuck with this for now. Maybe there are undocumented constructors somewhere.
4) Well quaternions can not be elements of a vector, but it can be elements of a matrix! Whoo Hoo! Something like
mat12 = matrix([q1,q2])
will actually create row matrix from two quaternions. Now I can implement the direct sum of two biquaternions, which is the odd degenerate space I have to work with. I guess someone forgot or didn't see the need to implement a _vector_ method.
5) As for rotations I guess we are on our own here. You will have to implement that your self as well as slerp and so forth for the computer graphics guys. I guess reflections or Lorentz transformations and so forth, which are nicely expressed in quaternions would also have to be a user application for now, along with wedge products, inner products and all the other types of multiplication in geometric algebras/clifford algebras.
Just one more comment:
The performance of symbolic quaternions is actually pretty good. In timing tests it's about 10 times faster than embedding it in the isomorphic Clifford algebra within Sage and about 30 times faster than my Matlab/Mupad implementation. Of course the latter uses symbolic matrices, which forces the duplication of symbolic elements.
3 | No.3 Revision |
After hacking away at this for a day or so, I can start answering some of my own questions. One reason why I didn't have answers right away is due to the fact that the automatically generated documentation for the quaternions does not cover the methods in the parent class nor does it cover several external functions that still work against the quaternion object.
The other problem is that I am not an algebraist. So for example the fact that the scalar part is actually half the reduced trace was not readily obvious. So here is my take so far on my "issues".
1) Let q be an instance of a quaternion. q.reduced_trace()/2 is the scalar part. But even better is the undocumented fact that the [] operator has been overloaded so that you can simply do q[0]. That latter is a nice feature. Once you have that generating the "vector part" is easy enough.
2) Another undocumented feature is the .C method for matrices and the .conjugate() method which appears to exist for both quaternions and matrices. However it only gives you the quaternion conjugation not the elementwise complex conjugation. The latter has to be added by the programmer as far as I can tell.
As for the other automorphisms like involution and reversion, they would have to be implemented by the programmer as far as I can tell. I suspect the same might be true for the more general Clifford algebras, but I'm not certain.
3) I'm stuck with this for now. Maybe there are undocumented constructors somewhere.
4) Well quaternions can not be elements of a vector, but it can be elements of a matrix! Whoo Hoo! Something like
mat12 = matrix([q1,q2])
will actually create row matrix from two quaternions. Now I can implement the direct sum of two biquaternions, which is the odd degenerate space I have to work with. I guess someone forgot or didn't see the need to implement a _vector_ method.
5) As for rotations I guess we are on our own here. You will have to implement that your self as well as slerp and so forth for the computer graphics guys. I guess reflections or Lorentz transformations and so forth, which are nicely expressed in quaternions would also have to be a user application for now, along with wedge products, inner products and all the other types of multiplication in geometric algebras/clifford algebras.
I have accumulated a few more complaints though as I have continued. First it appears that there is not a lot of support for global substitutions on symbolic quaternions. You can't define quaternion functions symbolically and you can't do global variable substitutions without directly accessing the components. Global differentiation also appears broken.
Another gaping hole for any serious use of these libraries is the complete absence of quaternion transcendental functions. First there is no inverse! Yup quaternion inverse is missing. There is no exponentiation, no logarithm, no powers etc. etc. The norm function is not actually the norm, but the square norm, but only for the standard choice of input arguments (-1,-1).
Just one more comment:
The performance of symbolic quaternions is actually pretty good. In timing tests it's about 10 times faster than embedding it in the isomorphic Clifford algebra within Sage and about 30 times faster than my Matlab/Mupad implementation. Of course the latter uses symbolic matrices, which forces the duplication of symbolic elements.