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 the Screw.show method 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_point is not as point.

change_point(new_point)

Computes and returns the (co)screw on the new reference point. The formula changes according to the type of screw.

Parameters

new_pointMultiVector

The new point.

Returns

out(Co)Screw

The screw on new_point.

show(new_point=None)

Print the (co)screw on a given point.

Parameters

new_pointMultiVector, optionnal

The point on which the (co)screw should be shown. If no point was given, it shows the (co)screw at its reference point.

class screw.Screw(ref_point, resultant, moment)

Screw object.

The following operators have been overloaded:

  • the addition of screws self + other

  • the right-handed addition other + self

  • the outer product of screws self ^ other

Methods

dual()

Compte the dual coscrew of a screw.

Returns

outCoScrew

The dual coscrew.

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 + other

  • the right-handed addition other + self

  • the product between a scalar and a coscrew scalar * self

Methods

composition(other)

Compute the composition of two coscrews.

Parameters

otherCoScrew

The other coscrew.

Returns

outCoScrew

The result of the composition.

Raises

TypeError

If other is not a CoScrew instance.

ValueError

If the two resultants are not spinors.

See also

This class inherits from the ScrewBase one.

Functions

screw.comoment(coscrew: CoScrew, screw: Screw)

Compute the real comoment between a coscrew and a screw.

Parameters

coscrewCoScrew

The coscrew.

screwScrew

The screw.

Returns

outMultiVector

The real comoment between the given coscrew and the screw.

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