|
glucat 0.13.0
|


Public Attributes | |
| instance = new Clifford((<clifford>other).unwrap()) | |
Python class clifford wraps C++ class Clifford.
Definition at line 532 of file PyClical.pyx.
| PyClical.clifford.__add__ | ( | lhs, | |
| rhs ) |
Geometric sum.
>>> print(clifford(1) + clifford("{2}"))
1+{2}
>>> print(clifford("{1}") + clifford("{2}"))
{1}+{2}
Definition at line 740 of file PyClical.pyx.
| PyClical.clifford.__and__ | ( | lhs, | |
| rhs ) |
Inner product.
>>> print(clifford("{1}") & clifford("{2}"))
0
>>> print(clifford(2) & clifford("{2}"))
0
>>> print(clifford("{1}") & clifford("{1}"))
1
>>> print(clifford("{1}") & clifford("{1,2}"))
{2}
Definition at line 872 of file PyClical.pyx.
| PyClical.clifford.__call__ | ( | self, | |
| grade ) |
Pure grade-vector part.
>>> print(clifford("{1}")(1))
{1}
>>> print(clifford("{1}")(0))
0
>>> print(clifford("1+{1}+{1,2}")(0))
1
>>> print(clifford("1+{1}+{1,2}")(1))
{1}
>>> print(clifford("1+{1}+{1,2}")(2))
{1,2}
>>> print(clifford("1+{1}+{1,2}")(3))
0
Definition at line 1083 of file PyClical.pyx.
References instance, and PyClical.index_set.instance.
| PyClical.clifford.__cinit__ | ( | self, | |
| other = 0, | |||
| ixt = None ) |
Construct an object of type clifford.
>>> print(clifford(2))
2
>>> print(clifford(2.0))
2
>>> print(clifford(1.0e-1))
0.1
>>> print(clifford("2"))
2
>>> print(clifford("2{1,2,3}"))
2{1,2,3}
>>> print(clifford(clifford("2{1,2,3}")))
2{1,2,3}
>>> print(clifford("-{1}"))
-{1}
>>> print(clifford(2,index_set({1,2})))
2{1,2}
>>> print(clifford([2,3],index_set({1,2})))
2{1}+3{2}
Definition at line 565 of file PyClical.pyx.
| PyClical.clifford.__contains__ | ( | self, | |
| x ) |
Not applicable.
>>> x=clifford(index_set({-3,4,7})); -3 in x
Traceback (most recent call last):
...
TypeError: Not applicable.
Definition at line 627 of file PyClical.pyx.
| PyClical.clifford.__dealloc__ | ( | self | ) |
Clean up by deallocating the instance of C++ class Clifford.
Definition at line 621 of file PyClical.pyx.
References instance, and PyClical.index_set.instance.
| PyClical.clifford.__getitem__ | ( | self, | |
| ixt ) |
Subscripting: map from index set to scalar coordinate.
>>> clifford("{1}")[index_set(1)]
1.0
>>> clifford("{1}")[index_set({1})]
1.0
>>> clifford("{1}")[index_set({1,2})]
0.0
>>> clifford("2{1,2}")[index_set({1,2})]
2.0
Definition at line 707 of file PyClical.pyx.
References instance, and PyClical.index_set.instance.
| PyClical.clifford.__iadd__ | ( | self, | |
| rhs ) |
Geometric sum.
>>> x = clifford(1); x += clifford("{2}"); print(x)
1+{2}
Definition at line 760 of file PyClical.pyx.
| PyClical.clifford.__iand__ | ( | self, | |
| rhs ) |
Inner product.
>>> x = clifford("{1}"); x &= clifford("{2}"); print(x)
0
>>> x = clifford(2); x &= clifford("{2}"); print(x)
0
>>> x = clifford("{1}"); x &= clifford("{1}"); print(x)
1
>>> x = clifford("{1}"); x &= clifford("{1,2}"); print(x)
{2}
Definition at line 896 of file PyClical.pyx.
| PyClical.clifford.__idiv__ | ( | self, | |
| rhs ) |
Geometric quotient.
>>> x = clifford("{1}"); x /= clifford("{2}"); print(x)
{1,2}
>>> x = clifford(2); x /= clifford("{2}"); print(x)
2{2}
>>> x = clifford("{1}"); x /= clifford("{1}"); print(x)
1
>>> x = clifford("{1}"); x /= clifford("{1,2}"); print(x)
-{2}
Definition at line 974 of file PyClical.pyx.
| PyClical.clifford.__imod__ | ( | self, | |
| rhs ) |
Contraction.
>>> x = clifford("{1}"); x %= clifford("{2}"); print(x)
0
>>> x = clifford(2); x %= clifford("{2}"); print(x)
2{2}
>>> x = clifford("{1}"); x %= clifford("{1}"); print(x)
1
>>> x = clifford("{1}"); x %= clifford("{1,2}"); print(x)
{2}
Definition at line 857 of file PyClical.pyx.
| PyClical.clifford.__imul__ | ( | self, | |
| rhs ) |
Geometric product.
>>> x = clifford(2); x *= clifford("{2}"); print(x)
2{2}
>>> x = clifford("{1}"); x *= clifford("{2}"); print(x)
{1,2}
>>> x = clifford("{1}"); x *= clifford("{1,2}"); print(x)
{2}
Definition at line 820 of file PyClical.pyx.
| PyClical.clifford.__ior__ | ( | self, | |
| rhs ) |
Transform left hand side, using right hand side as a transformation.
>>> x=clifford("{1,2}") * pi/2; y=clifford("{1}"); y|=x; print(y)
-{1}
>>> x=clifford("{1,2}") * pi/2; y=clifford("{1}"); y|=exp(x); print(y)
-{1}
Definition at line 1013 of file PyClical.pyx.
| PyClical.clifford.__isub__ | ( | self, | |
| rhs ) |
Geometric difference.
>>> x = clifford(1); x -= clifford("{2}"); print(x)
1-{2}
Definition at line 789 of file PyClical.pyx.
| PyClical.clifford.__iter__ | ( | self | ) |
Not applicable.
>>> for a in clifford(index_set({-3,4,7})):print(a, end=",")
Traceback (most recent call last):
...
TypeError: Not applicable.
Definition at line 638 of file PyClical.pyx.
| PyClical.clifford.__ixor__ | ( | self, | |
| rhs ) |
Outer product.
>>> x = clifford("{1}"); x ^= clifford("{2}"); print(x)
{1,2}
>>> x = clifford(2); x ^= clifford("{2}"); print(x)
2{2}
>>> x = clifford("{1}"); x ^= clifford("{1}"); print(x)
0
>>> x = clifford("{1}"); x ^= clifford("{1,2}"); print(x)
0
Definition at line 935 of file PyClical.pyx.
| PyClical.clifford.__mod__ | ( | lhs, | |
| rhs ) |
Contraction.
>>> print(clifford("{1}") % clifford("{2}"))
0
>>> print(clifford(2) % clifford("{2}"))
2{2}
>>> print(clifford("{1}") % clifford("{1}"))
1
>>> print(clifford("{1}") % clifford("{1,2}"))
{2}
Definition at line 833 of file PyClical.pyx.
| PyClical.clifford.__mul__ | ( | lhs, | |
| rhs ) |
Geometric product.
>>> print(clifford("{1}") * clifford("{2}"))
{1,2}
>>> print(clifford(2) * clifford("{2}"))
2{2}
>>> print(clifford("{1}") * clifford("{1,2}"))
{2}
Definition at line 798 of file PyClical.pyx.
| PyClical.clifford.__neg__ | ( | self | ) |
Unary -.
>>> print(-clifford("{1}"))
-{1}
Definition at line 722 of file PyClical.pyx.
References instance, and PyClical.index_set.instance.
| PyClical.clifford.__or__ | ( | lhs, | |
| rhs ) |
Transform left hand side, using right hand side as a transformation.
>>> x=clifford("{1,2}") * pi/2; y=clifford("{1}"); print(y|x)
-{1}
>>> x=clifford("{1,2}") * pi/2; y=clifford("{1}"); print(y|exp(x))
-{1}
Definition at line 1002 of file PyClical.pyx.
| PyClical.clifford.__pos__ | ( | self | ) |
Unary +.
>>> print(+clifford("{1}"))
{1}
Definition at line 731 of file PyClical.pyx.
| PyClical.clifford.__pow__ | ( | self, | |
| m, | |||
| dummy ) |
Power: self to the m.
>>> x=clifford("{1}"); print(x ** 2)
1
>>> x=clifford("2"); print(x ** 2)
4
>>> x=clifford("2+{1}"); print(x ** 0)
1
>>> x=clifford("2+{1}"); print(x ** 1)
2+{1}
>>> x=clifford("2+{1}"); print(x ** 2)
5+4{1}
>>> i=clifford("{1,2}"); print(exp(pi/2) * (i ** i))
1
Definition at line 1024 of file PyClical.pyx.
References pow().
| PyClical.clifford.__radd__ | ( | rhs, | |
| lhs ) |
Geometric sum.
>>> print(1 + clifford("{2}"))
1+{2}
Definition at line 751 of file PyClical.pyx.
| PyClical.clifford.__rand__ | ( | rhs, | |
| lhs ) |
Inner product.
>>> print(2 & clifford("{2}"))
0
Definition at line 887 of file PyClical.pyx.
| PyClical.clifford.__repr__ | ( | self | ) |
The “official” string representation of self.
>>> clifford("1+3{-1}+2{1,2}+4{-2,7}").__repr__()
'clifford("1+3{-1}+2{1,2}+4{-2,7}")'
Definition at line 1298 of file PyClical.pyx.
References clifford_to_repr().
| PyClical.clifford.__richcmp__ | ( | lhs, | |
| rhs, | |||
| int, | |||
| op ) |
Compare objects of type clifford.
>>> clifford("{1}") == clifford("1{1}")
True
>>> clifford("{1}") != clifford("1.0{1}")
False
>>> clifford("{1}") != clifford("1.0")
True
>>> clifford("{1,2}") == None
False
>>> clifford("{1,2}") != None
True
>>> None == clifford("{1,2}")
False
>>> None != clifford("{1,2}")
True
Definition at line 672 of file PyClical.pyx.
| PyClical.clifford.__rmod__ | ( | rhs, | |
| lhs ) |
Contraction.
>>> print(2 % clifford("{2}"))
2{2}
Definition at line 848 of file PyClical.pyx.
| PyClical.clifford.__rmul__ | ( | rhs, | |
| lhs ) |
Geometric product.
>>> print(2 * clifford("{2}"))
2{2}
Definition at line 811 of file PyClical.pyx.
| PyClical.clifford.__rsub__ | ( | rhs, | |
| lhs ) |
Geometric difference.
>>> print(1 - clifford("{2}"))
1-{2}
Definition at line 780 of file PyClical.pyx.
| PyClical.clifford.__rtruediv__ | ( | rhs, | |
| lhs ) |
Geometric quotient.
>>> print(2 / clifford("{2}"))
2{2}
Definition at line 965 of file PyClical.pyx.
| PyClical.clifford.__rxor__ | ( | rhs, | |
| lhs ) |
Outer product.
>>> print(2 ^ clifford("{2}"))
2{2}
Definition at line 926 of file PyClical.pyx.
| PyClical.clifford.__str__ | ( | self | ) |
The “informal” string representation of self.
>>> clifford("1+3{-1}+2{1,2}+4{-2,7}").__str__()
'1+3{-1}+2{1,2}+4{-2,7}'
Definition at line 1307 of file PyClical.pyx.
References clifford_to_str().
| PyClical.clifford.__sub__ | ( | lhs, | |
| rhs ) |
Geometric difference.
>>> print(clifford(1) - clifford("{2}"))
1-{2}
>>> print(clifford("{1}") - clifford("{2}"))
{1}-{2}
Definition at line 769 of file PyClical.pyx.
| PyClical.clifford.__truediv__ | ( | lhs, | |
| rhs ) |
Geometric quotient.
>>> print(clifford("{1}") / clifford("{2}"))
{1,2}
>>> print(clifford(2) / clifford("{2}"))
2{2}
>>> print(clifford("{1}") / clifford("{1}"))
1
>>> print(clifford("{1}") / clifford("{1,2}"))
-{2}
Definition at line 950 of file PyClical.pyx.
| PyClical.clifford.__xor__ | ( | lhs, | |
| rhs ) |
Outer product.
>>> print(clifford("{1}") ^ clifford("{2}"))
{1,2}
>>> print(clifford(2) ^ clifford("{2}"))
2{2}
>>> print(clifford("{1}") ^ clifford("{1}"))
0
>>> print(clifford("{1}") ^ clifford("{1,2}"))
0
Definition at line 911 of file PyClical.pyx.
| PyClical.clifford.abs | ( | self | ) |
Absolute value: square root of norm.
>>> clifford("1+{-1}+{1,2}+{1,2,3}").abs()
2.0
Definition at line 1238 of file PyClical.pyx.
References glucat.abs().
| PyClical.clifford.conj | ( | self | ) |
Conjugation, reverse o involute == involute o reverse.
>>> print((clifford("{1}")).conj())
-{1}
>>> print((clifford("{2}") * clifford("{1}")).conj())
{1,2}
>>> print((clifford("{1}") * clifford("{2}")).conj())
-{1,2}
>>> print(clifford("1+{1}+{1,2}").conj())
1-{1}-{1,2}
Definition at line 1201 of file PyClical.pyx.
References conj(), instance, and PyClical.index_set.instance.
Referenced by conj().
| PyClical.clifford.even | ( | self | ) |
Even part of multivector, sum of even grade terms.
>>> print(clifford("1+{1}+{1,2}").even())
1+{1,2}
Definition at line 1124 of file PyClical.pyx.
References even(), instance, and PyClical.index_set.instance.
Referenced by even().
| PyClical.clifford.frame | ( | self | ) |
Subalgebra generated by all generators of terms of given multivector.
>>> print(clifford("1+3{-1}+2{1,2}+4{-2,7}").frame())
{-2,-1,1,2,7}
>>> s=clifford("1+3{-1}+2{1,2}+4{-2,7}").frame(); type(s)
<class 'PyClical.index_set'>
Definition at line 1287 of file PyClical.pyx.
References frame(), instance, and PyClical.index_set.instance.
Referenced by frame().
| PyClical.clifford.inv | ( | self | ) |
Geometric multiplicative inverse.
>>> x = clifford("{1}"); print(x.inv())
{1}
>>> x = clifford(2); print(x.inv())
0.5
>>> x = clifford("{1,2}"); print(x.inv())
-{1,2}
Definition at line 989 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and inv().
Referenced by inv().
| PyClical.clifford.involute | ( | self | ) |
Main involution, each {i} is replaced by -{i} in each term,
eg. clifford("{1}") -> -clifford("{1}").
>>> print(clifford("{1}").involute())
-{1}
>>> print((clifford("{2}") * clifford("{1}")).involute())
-{1,2}
>>> print((clifford("{1}") * clifford("{2}")).involute())
{1,2}
>>> print(clifford("1+{1}+{1,2}").involute())
1-{1}+{1,2}
Definition at line 1170 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and involute().
Referenced by involute().
| PyClical.clifford.isinf | ( | self | ) |
Check if a multivector contains any infinite values. >>> clifford().isinf() False
Definition at line 1269 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and isnan().
| PyClical.clifford.isnan | ( | self | ) |
Check if a multivector contains any IEEE NaN values. >>> clifford().isnan() False
Definition at line 1278 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and isnan().
| PyClical.clifford.max_abs | ( | self | ) |
Maximum of absolute values of components of multivector: multivector infinity norm.
>>> clifford("1+{-1}+{1,2}+{1,2,3}").max_abs()
1.0
>>> clifford("3+2{1}+{1,2}").max_abs()
3.0
Definition at line 1247 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and max_abs().
Referenced by max_abs().
| PyClical.clifford.norm | ( | self | ) |
Norm == sum of squares of coordinates.
>>> clifford("1+{1}+{1,2}").norm()
3.0
>>> clifford("1+{-1}+{1,2}+{1,2,3}").norm()
4.0
Definition at line 1227 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and norm().
Referenced by norm().
| PyClical.clifford.odd | ( | self | ) |
Odd part of multivector, sum of odd grade terms.
>>> print(clifford("1+{1}+{1,2}").odd())
{1}
Definition at line 1133 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and odd().
Referenced by odd().
| PyClical.clifford.outer_pow | ( | self, | |
| m ) |
Outer product power.
>>> x=clifford("2+{1}"); print(x.outer_pow(0))
1
>>> x=clifford("2+{1}"); print(x.outer_pow(1))
2+{1}
>>> x=clifford("2+{1}"); print(x.outer_pow(2))
4+4{1}
>>> print(clifford("1+{1}+{1,2}").outer_pow(3))
1+3{1}+3{1,2}
Definition at line 1067 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and outer_pow().
Referenced by outer_pow().
| PyClical.clifford.pow | ( | self, | |
| m ) |
Power: self to the m.
>>> x=clifford("{1}"); print(x.pow(2))
1
>>> x=clifford("2"); print(x.pow(2))
4
>>> x=clifford("2+{1}"); print(x.pow(0))
1
>>> x=clifford("2+{1}"); print(x.pow(1))
2+{1}
>>> x=clifford("2+{1}"); print(x.pow(2))
5+4{1}
>>> print(clifford("1+{1}+{1,2}").pow(3))
1+3{1}+3{1,2}
>>> i=clifford("{1,2}"); print(exp(pi/2) * i.pow(i))
1
Definition at line 1043 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and pow().
| PyClical.clifford.pure | ( | self | ) |
Pure part.
>>> print(clifford("1+{1}+{1,2}").pure())
{1}+{1,2}
>>> print(clifford("{1,2}").pure())
{1,2}
Definition at line 1113 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and pure().
Referenced by pure().
| PyClical.clifford.quad | ( | self | ) |
Quadratic form == (rev(x)*x)(0).
>>> print(clifford("1+{1}+{1,2}").quad())
3.0
>>> print(clifford("1+{-1}+{1,2}+{1,2,3}").quad())
2.0
Definition at line 1216 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and quad().
Referenced by quad().
| PyClical.clifford.reframe | ( | self, | |
| ixt ) |
Put self into a larger frame, containing the union of self.frame() and index set ixt.
This can be used to make multiplication faster, by multiplying within a common frame.
>>> clifford("2+3{1}").reframe(index_set({1,2,3}))
clifford("2+3{1}")
>>> s=index_set({1,2,3});t=index_set({-3,-2,-1});x=random_clifford(s); x.reframe(t).frame() == (s|t);
True
Definition at line 649 of file PyClical.pyx.
| PyClical.clifford.reverse | ( | self | ) |
Reversion, eg. clifford("{1}")*clifford("{2}") -> clifford("{2}")*clifford("{1}").
>>> print(clifford("{1}").reverse())
{1}
>>> print((clifford("{2}") * clifford("{1}")).reverse())
{1,2}
>>> print((clifford("{1}") * clifford("{2}")).reverse())
-{1,2}
>>> print(clifford("1+{1}+{1,2}").reverse())
1+{1}-{1,2}
Definition at line 1186 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and reverse().
Referenced by reverse().
| PyClical.clifford.scalar | ( | self | ) |
Scalar part.
>>> clifford("1+{1}+{1,2}").scalar()
1.0
>>> clifford("{1,2}").scalar()
0.0
Definition at line 1102 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and scalar().
Referenced by scalar().
| PyClical.clifford.truncated | ( | self, | |
| limit ) |
Remove all terms of self with relative size smaller than limit.
>>> clifford("1e8+{1}+1e-8{1,2}").truncated(1.0e-6)
clifford("100000000")
>>> clifford("1e4+{1}+1e-4{1,2}").truncated(1.0e-6)
clifford("10000+{1}")
Definition at line 1258 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and truncated().
Referenced by truncated().
| PyClical.clifford.vector_part | ( | self, | |
| frm = None ) |
Vector part of multivector, as a Python list, with respect to frm.
>>> print(clifford("1+2{1}+3{2}+4{1,2}").vector_part())
[2.0, 3.0]
>>> print(clifford("1+2{1}+3{2}+4{1,2}").vector_part(index_set({-1,1,2})))
[0.0, 2.0, 3.0]
Definition at line 1142 of file PyClical.pyx.
References instance, PyClical.index_set.instance, and vector_part().
Referenced by vector_part().
Definition at line 592 of file PyClical.pyx.
Referenced by __call__(), __dealloc__(), __getitem__(), __neg__(), conj(), even(), frame(), inv(), involute(), isinf(), isnan(), max_abs(), norm(), odd(), outer_pow(), pow(), pure(), quad(), reverse(), scalar(), truncated(), and vector_part().