Screws and coscrews
This module provides two classes that respectively implement a screw and a coscrew.
Classes
- class screw.ScrewBase(ref_point, resultant, moment)
Provides a set of common methods for Screw and CoScrew classes.
Note
You can print a Screw directly by
print(my_screw)but it is recommended to use theScrew.showmethod in order to have a better control on the reference point.Attributes
- ref_pointMultiVector
The point of reference of the screw.
- resultantMultiVector
The resultant multivector S or the screw.
- momentMultiVector
The moment multivector M of the the screw.
Methods
- __init__(ref_point, resultant, moment)
Constructor method.
Parameters
- ref_pointMultiVector
The point of reference of the (co)screw
- resultantMultiVector
The resultant of the (co)screw, usually named S.
- momentMultiVector
The moment of the (co)screw, usually named M.
Raises
- TypeError
If
ref_pointis not as point.
- class screw.Screw(ref_point, resultant, moment)
Screw object.
The following operators have been overloaded:
the addition of screws
self + otherthe right-handed addition
other + selfthe outer product of screws
self ^ other
Methods
See also
This class inherits from the ScrewBase one.
- class screw.CoScrew(ref_point, resultant, moment)
Coscrew object
The following operators have been overloaded:
the addition of coscrews
self + otherthe right-handed addition
other + selfthe product between a scalar and a coscrew
scalar * self
Methods
See also
This class inherits from the ScrewBase one.
Functions
Exemples
Before using these objects, you should import the geometric_algebra module so that you can
create multivectors. For basic physical applications, a three-dimensional algebra should be enough, but you
can use n-dimensional multivectors.
Let’s see a minimal exemple:
>>> import gscrew
>>> from gscrew.geometric_algebra import GeometricAlgebra
>>> from gscrew.screw import Screw
>>> my_algebra = GeometricAlgebra(3) # a 3-D geometric algebra
>>> locals().update(my_algebra.blades) # add the basis blades to the locals (i.e. 1, e1, e2…)
>>> reference_point = 0*s # the point of reference for the screw (here, the origin)
>>> resultant = 2 + (3*e1) + (6*e3) # creates a MultiVector for the screw's resultant
>>> moment = (2*e1) + (5*e2) + e3 # creates another MultiVector for the screw's moment
>>> my_screw = Screw(reference_point, resultant, moment) # finally we create a Screw instance