Releases: Kenny2github/MultiVectors
Releases · Kenny2github/MultiVectors
1.2.1
1.2.0
New Stuff
- Proper docs instead of a monolithic
docs.md
file.
Removed
- BREAKING: Scalar factories are no longer supported. They make typechecking extremely difficult and are too magical.
- Since it's doubtful that anyone was using them (or this library, for that matter...) this is not marked with a major version change.
1.1.0
New Stuff
MultiVector.exp
computesmath.e ** V
using the Taylor series, which basically applies to anything for which scalar-thing and thing-thing addition and multiplication are defined.MultiVector.scalar
classmethod generates a scalar MultiVector from a string, by passing it through the scalar factory.
Changes
MultiVector.__rpow__
is now defined in terms ofMultiVector.exp
(a^b = e^(b ln a))- BREAKING: This means that
math.e ** V == V.exp
has different behavior from previousmath.e ** V
whenV*V != -1
. This is because previously I was mistakenly applying Euler's formula to objects that do not behave like the imaginary unit. The docs have been updated to reflect this. - Since this is a correction of behavior, I'm calling it a bugfix and not incrementing the major version.
- Note that the behavior remains the same across versions when
V*V == -1
, which should be the case for all valid use cases ofMultiVector.rotate
- BREAKING: This means that
1.0.0
New Stuff
MultiVector.grade
returns the grade of a blade (a single-term multivector) orNone
if the multivector has more than one term.- FEATURE: Scalar factories, by means of
multivectors.set_scalar_factory()
. See the end of the docs. MultiVector
s can now compare equal to scalars if they themselves are scalar.MultiVector
s can now be relationally compared with scalars if they themselves are scalar.MultiVector
s can now be 1/ed, but only if they are blades.MultiVector.__invert__
implements the conjugate.
Changes
- BREAKING: Removed
Blade
class. It is replaced by single-termMultiVector
s. - BREAKING: Swapped behaviors of
v % grade
andv[idxs]
- they are nowv % idxs
andv[grade(s)]
because[]
notation denotes subscript more often. MultiVector.terms
now returns a tuple of single-termMultiVector
s.MultiVector.__init__
now takes a more active role in casting values to the scalar factory.- An empty
MultiVector
is no longer possible; if there are no terms, a scalar 0 is inserted. MultiVector.from_terms
now always returns aMultiVector
, which means that all operations now do too.repr(n * _)
='(' + repr(n) + ')'
to distinguish it fromn
.- Since
Blade
is no more,repr(v)
now*
-multiples bases instead of swizzling them. MultiVector.__pow__
no longer supports ternarypow()
because modulo means index swizzling now.- Normalization is now done by
MultiVector.__pos__
instead of__invert__
. math.fsum()
is no longer used as it causesDecimal
s to lose precision by casting them to floats. If you need precision in addition, useDecimal
.MultiVector.rotate
will now raise aTypeError
ifplane
is not a basis.
0.1.1
New Stuff
Blade.__eq__, Blade.__ne__, MultiVector.__eq__, MultiVector.__ne__
are now defined for all objects.Blade.__lt__, Blade.__le__, Blade.__gt__, Blade.__ge__
are now defined for blades of the same bases.- New documentation.
run_tests.py
runsdoctest
on the module and Markdown, with a non-zero exit status on failure.
Fixes
- A couple of fixes in doctests.
0.1.0
New Features
multivectors.xy
andfrom multivectors import xyz
are now a thing (swizzling on the module level) but unlike class-level swizzling, invalid chars will cause anAttributeError
(from multivectors import a
would seta
to1.0
otherwise)Blade.terms
returns(blade,)
for compatibility withMultiVector.terms
real @ blade
is now supportedA ** -n = 1 / (A ** n)
real ^ blade
is now supported- To better mimic regular
float
s, scalar blades can now be passed tocomplex()
,int()
, andarr[]
round(blade)
,math.trunc(blade)
,math.floor(blade)
, andmath.ceil(blade)
act on the scalar part, returning that times the basessimple @ multivector
is now supportedsimple ^ multivector
is now supportedround(multivector)
,math.trunc(multivector)
,math.floor(multivector)
, andmath.ceil(multivector)
act on each component of the multivector, returning their sum
Changes
names_to_idxs()
takes a new parameter that controls whether to fail on invalid charsrepr(Blade)
usesrepr()
on its scalar again;%.2f
is still used instr()
multivector ** -n
is now explicitly rejected
Fixes
names_to_idxs()
no longer fails on invalid chars betweene
and the digits of the number (enablese_1
)idxs_to_idxs()
now always returns a liststr(Blade)
used to returne0
fore1
blade @ non-simple
now correctly fails- Fixed infinite recursion when
Blade(scalar=x) / blade
blade ^ non-simple
now correctly failsblade ^ real
no longer fails- Correction:
abs(blade)
is(blade * blade) ** .5
, notblade.scalar
float(blade)
can't returnNotImplemented
, so raiseTypeError
multivector % grade
now returns the blades, not just their scalarsMultiVector.angle_to()
returns a real, not aMultiVector
.- Noted in docstring of
MultiVector.angle_to()
that multivectors of singular grade 1 only are accepted
0.0.0
Initial release
- Create the library