Skip to content

Python tool to perform quaternionic algebra and geometry

License

Notifications You must be signed in to change notification settings

ferrixio/Quaternion-agc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quaternion-agc: a Python 3.10 resource

Perform quaternionic algebra and geometry easily in Python

🐉 Author: Samuele Ferri (@ferrixio)

⭐ Version 2.2.4

📜 Changelog

TABLE OF CONTENTS

  1. Requirements
  2. Features
  3. Known issues
  4. Future ideas

1. REQUIREMENTS

Python version: 3.10 or above

Additional packages: numpy, matplotlib

2. FEATURES

This class allows user to emulate quaternionic algebra in Python. The class can do:

> internal and external sums
> scalar multiplications
> internal left-multiplications
> internal right-multiplications
> integer powers
> divisions
> floordivisions
> modulos
> normalizations
> conjugations
> inversions
> algebric prints
> type casting (int, float, complex)
> iterations
> random generations
> exponential and logarithmic functions
> dot product, cross product and commutator
> extraction or generation from 3D rotations
> rotate points in 3D
> plotting quaternions

I used mostly magic methods to allow users to write x+y, x*y, x/y, ..., directly.

I recommend reading how to build a quaternion to better understand how to define and use a quaternion.

Every value below 1e-13 is treated as 0, especially during logical checks. This does NOT imply that the value is set to 0!

The new class Hplot is used to plot quaternions in different ways. Also, I invite you to read how to plot quaternions to understand how to plot them.

The class functions contains many methods to perform quaternionic calculus [work in progress].

"agc" in the title stands for "algebra-geometry-calculus".

3. KNOWN ISSUES

  • The in_place operations +=, -=, *= and so on, don't work if on the left side there isn't a quaternion.
  • There is a little chance that the method Hplot.__getColors returns negative numbers.

4. FUTURE IDEAS

  • ⭕ Add custom quaternionic functions
  • ⭕ Add more algebra and calculus to the field
  • ⭕ Add colorbar in plot to represent the real parts
  • ⭕ Study the topology of lists of quaternions
  • ✅ Vector representation
  • ✅ Add complex compatibility
  • ✅ Quaternionic functions
  • ✅ Floor division
  • ✅ Add @ operator
  • ✅ Plotting quaternions
  • ✅ Autogeneration of versors
  • ✅ Literally use LaTeX to write the .md files
  • ✅ Create a library/package
  • ⚠️ Implementing rotation of 3D objects

Legend:

⭕ = solution not (yet) found

✅ = solution found and implemented

⚠️ = solution found but the implementation needs to be improved