Skip to main content

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 [sgn(q), 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]

Contributors

Andrzej Kapanowski (project leader)

Jan Ferdyan (quaternion functions)

References

[1] http://en.wikipedia.org/wiki/Quaternion

[2] Real Quaternionic Calculus Handbook, João Pedro Morais, Svetlin Georgiev, Wolfgang Sprößig, Birkhäuser Basel 2014.

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.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyquats-1.1.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file pyquats-1.1.0.tar.gz.

File metadata

  • Download URL: pyquats-1.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for pyquats-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8b4b44eda0622e830ced877d50d5b60033c55c089f64f6ab5ec3c14865083bc3
MD5 1fd528e3809cc747b4a9c57e18295beb
BLAKE2b-256 65109e86832b7c233891f7f296bb228829a5e9c7e3dde17d7576249957b6cc59

See more details on using hashes here.

File details

Details for the file pyquats-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyquats-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for pyquats-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c5834cc5d955d851e972189e31fa97d5fb0cc5672f9331358c64c560e713e89
MD5 87e1f1f342165d861452ce218f632eb9
BLAKE2b-256 c2ae3aa9a693a955eccc5ffa08f4f9514789ede59a576d0cbdabfff310671a0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page