Pdfs.Semanticscholar.Org/Baba/976Fd7f6577eeaa1d3ef488c1db13ec24652.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
Clifford Documentation Release 1.5.0dev0 Clifford Team Sep 02, 2021 CONTENTS 1 Installation 3 1.1 conda...................................................3 1.2 PyPI...................................................3 2 API 5 2.1 clifford (clifford)...........................................5 2.1.1 Constructing algebras......................................5 2.1.2 Global configuration functions................................. 16 2.1.3 Miscellaneous classes...................................... 17 2.1.4 Miscellaneous functions.................................... 18 2.2 cga (clifford.cga)........................................... 19 2.2.1 The CGA............................................ 19 2.2.2 Objects............................................. 21 2.2.3 Operators............................................ 25 2.2.4 Meta-Class........................................... 29 2.3 tools (clifford.tools)........................................ 30 2.3.1 Tools for specific ga’s...................................... 31 2.3.2 Classifying conformal GAs................................... 57 2.3.3 Determining Rotors From Frame Pairs or Orthogonal Matrices................ 59 2.4 operator functions (clifford.operator)............................... 62 2.5 transformations (clifford.transformations)............................ 62 2.5.1 Base classes........................................... 62 2.5.2 Matrix-backed implementations................................ 63 2.5.3 Helper functions........................................ 65 2.6 taylor_expansions (clifford.taylor_expansions)......................... 65 2.6.1 Implemented functions..................................... 66 2.7 numba extension support (clifford.numba).............................. 66 2.7.1 Supported operations...................................... 67 2.7.2 Performance considerations................................... 68 3 Predefined Algebras 69 4 Changelog 71 4.1 Changes in 1.4.x............................................. 71 4.1.1 Bugs fixed............................................ 71 4.1.2 Compatibility notes....................................... 72 4.2 Changes in 1.3.x............................................. 72 4.2.1 Bugs fixed............................................ 72 4.2.2 Compatibility notes....................................... 73 4.2.3 Patch releases.......................................... 73 i 4.3 Changes in 1.2.x............................................. 73 4.3.1 Bugs fixed............................................ 74 4.3.2 Compatibility notes....................................... 74 4.4 Changes in 1.1.x............................................. 74 4.4.1 Compatibility notes....................................... 74 4.4.2 Bugs fixed............................................ 74 4.4.3 Internal changes......................................... 75 4.5 Changes 0.6-0.7............................................. 75 4.6 Changes 0.5-0.6............................................. 75 4.7 Acknowledgements............................................ 75 5 Issues 77 6 Quick Start (G2) 79 6.1 Setup................................................... 79 6.2 Basics................................................... 79 6.3 Reflection................................................. 80 6.4 Rotation................................................. 80 7 The Algebra Of Space (G3) 81 7.1 Setup................................................... 81 7.2 Basics................................................... 82 7.2.1 Products............................................. 82 7.2.2 Defects in Precedence...................................... 82 7.2.3 Multivectors........................................... 83 7.2.4 Reversion............................................ 83 7.2.5 Grade Projection........................................ 83 7.2.6 Magnitude............................................ 84 7.2.7 Inverse.............................................. 84 7.2.8 Dual............................................... 84 7.2.9 Pretty, Ugly, and Display Precision............................... 84 7.3 Applications............................................... 85 7.3.1 Reflections........................................... 85 7.3.2 Rotations............................................ 86 7.3.3 Some Ways to use Functions.................................. 86 7.4 Changing Basis Names.......................................... 88 8 Rotations in Space: Euler Angles, Matrices, and Quaternions 89 8.1 Euler Angles with Rotors........................................ 89 8.2 Implementation of Euler Angles..................................... 90 8.3 Convert to Quaternions.......................................... 90 8.4 Convert to Rotation Matrix........................................ 91 8.5 Convert a Rotation Matrix to a Rotor.................................. 91 9 Space Time Algebra 93 9.1 Intro................................................... 93 9.2 Setup................................................... 93 9.3 The Space Time Split.......................................... 94 9.4 Splitting a space-time vector (an event)................................. 94 9.5 Splitting a Bivector............................................ 95 9.6 Lorentz Transformations......................................... 95 9.7 Lorentz Invariants............................................ 96 10 Interfacing Other Mathematical Systems 97 10.1 Complex Numbers............................................ 97 ii 10.2 Quaternions............................................... 99 11 Writing high(ish) performance code with Clifford and Numba via Numpy 103 11.1 First import the Clifford library as well as numpy and numba...................... 103 11.2 Choose a specific space......................................... 103 11.3 Performance of mathematically idiomatic Clifford algorithms..................... 104 11.4 Canonical blade coefficient representation in Clifford.......................... 105 11.5 Exploiting blade representation to write a fast function......................... 105 11.6 Composing larger functions....................................... 107 11.7 Algorithms exploiting known sparseness of MultiVector value array.................. 108 11.8 Future work on performance....................................... 111 12 Conformal Geometric Algebra 113 12.1 Using conformalize() ......................................... 113 12.2 Operations................................................ 115 12.2.1 Versors purely in E0 ...................................... 115 12.2.2 Versors partly in E0 ....................................... 116 12.2.3 Versors Out of E0 ........................................ 117 12.2.4 Combinations of Operations.................................. 118 12.3 More examples.............................................. 118 12.3.1 Visualization tools....................................... 119 12.3.2 Object Oriented CGA...................................... 123 12.3.3 Example 1 Interpolating Conformal Objects.......................... 127 12.3.4 Example 2 Clustering Geometric Objects........................... 130 12.3.5 Application to Robotic Manipulators.............................. 133 13 Linear transformations 143 13.1 Vector transformations in linear algebra................................. 143 13.2 Multivector transformations in geometric algebra............................ 144 13.2.1 Matrix representation...................................... 145 14 Working with custom algebras 147 14.1 Visualization............................................... 148 14.2 Apollonius’ problem in R2 with circles................................. 149 14.3 Apollonius’ problem in R3 with spheres................................. 150 15 Other resources for clifford 151 15.1 Slide Decks................................................ 151 15.2 Videos.................................................. 151 16 Other resources for Geometric Algebra 153 16.1 Links................................................... 153 16.2 Introductory textbooks.......................................... 153 17 Bibliography 155 Bibliography 157 Python Module Index 159 Index 161 iii iv Clifford Documentation, Release 1.5.0dev0 In [1]: from clifford.g3 import * # import GA for 3D space In [2]: import math In [3]: a= e1+2*e2+3*e3 # vector In [4]: R= math.e**(math.pi/4*e12) # rotor In [5]: R*a*~R # rotate the vector Out[5]: (2.0^e1) - (1.0^e2) + (3.0^e3) This module implements Geometric Algebras (a.k.a. Clifford algebras). Geometric Algebra (GA) is a universal algebra which subsumes complex algebra, quaternions, linear algebra and several other independent mathematical systems. Scalars, vectors, and higher-grade entities can be mixed freely and consistently in the form of mixed-grade multivectors. CONTENTS 1 Clifford Documentation, Release 1.5.0dev0 2 CONTENTS CHAPTER ONE INSTALLATION Clifford can be installed via the standard mechanisms for Python packages, and is available through both PyPIand Anaconda. 1.1 conda If you are using the Anaconda python distribution, then you should install using the conda command. Once you have anaconda installed you can install clifford from the conda-forge channel with the command: conda install-c conda-forge clifford 1.2 PyPI If you are not using Anaconda, you can install clifford from PyPI using the pip command that comes with Python: pip3 install clifford Note: The 1.3 release and older are not compatible with numba 0.50.0, and emit a large number of warnings on 0.49.0. To avoid these warnings,