Python implementation of quaternions
Project description
pyquats package
Python implementation of quaternions is presented.
Modules
- pyquats.quats - Quat class
- pyquats.numpyquats - Quat class using numpy (slow)
- pyquats.qmath - mathematical functions for quaternions [exp(q), log(c), sin(q), cos(q), sinh(q), cosh(q)]
- pyquats.qtools - rotations, random unit quaternions
Download
To install an official release do
python3 -m pip install pyquats
To get the git version do
git clone https://github.com/ufkapano/pyquats.git
Usage
See doc/quickstart.txt
>>> from pyquats.quats import Quat
>>> ii = Quat(0, 1)
>>> jj = Quat(0, 0, 1)
>>> kk = Quat(0, 0, 0, 1)
>>> ii * jj == kk
True
>>> ii ** 2 == jj ** 2 == kk ** 2 == -1
True
>>> all(q.is_unit() for q in (Quat(1), ii, jj, kk))
True
>>> p = Quat(5.0, 2.5, -3.6, 4.9)
>>> p.conjugate()
Quat(5.0, -2.5, 3.6, -4.9)
>>> ~p
Quat(0.0732922896511287, -0.03664614482556435, 0.052770448548812667, -0.07182644385810613)
>>> p * ~p
Quat(1.0, 0.0, -2.7755575615628914e-17, 5.551115123125783e-17)
>>> list(p)
[5.0, 2.5, -3.6, 4.9]
References
[1] http://en.wikipedia.org/wiki/Quaternion
EOF
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyquats-1.0.5.tar.gz
(14.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyquats-1.0.5-py3-none-any.whl
(21.7 kB
view details)
File details
Details for the file pyquats-1.0.5.tar.gz.
File metadata
- Download URL: pyquats-1.0.5.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c4feda934de51459768e74b5792d99ab3734ccac4ecb2e8f0a9b94f23195ed2
|
|
| MD5 |
bbb126da6fc296245a4ccf9159fa67af
|
|
| BLAKE2b-256 |
2777bf10c22afafd1b759ae67818e8dad0836fc413c223c5e671af81cc4bbe0b
|
File details
Details for the file pyquats-1.0.5-py3-none-any.whl.
File metadata
- Download URL: pyquats-1.0.5-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b968f9721065e39aa98eb43fe19cf59f59cfb3f64d28939fb5d5e16f5748a5bc
|
|
| MD5 |
da11ba20f984ffd09189d65a3665e423
|
|
| BLAKE2b-256 |
15051fcf42a3b91563a588a739ed2c530a8728c5511a2f279e2de07158b99db8
|