Skip to content

Releases: Kenny2github/MultiVectors

1.2.1

20 Dec 09:02
be44bbc
Compare
Choose a tag to compare

New Stuff

  • Formatting support (f-strings, format(), ...)

Changes

  • Run tests on more Python versions
  • Update docs and PyPI classifiers

1.2.0

04 Jul 01:22
Compare
Choose a tag to compare

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

04 Nov 06:57
Compare
Choose a tag to compare

New Stuff

  • MultiVector.exp computes math.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 of MultiVector.exp (a^b = e^(b ln a))
    • BREAKING: This means that math.e ** V == V.exp has different behavior from previous math.e ** V when V*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 of MultiVector.rotate

1.0.0

04 Jul 08:21
Compare
Choose a tag to compare

New Stuff

  • MultiVector.grade returns the grade of a blade (a single-term multivector) or None if the multivector has more than one term.
  • FEATURE: Scalar factories, by means of multivectors.set_scalar_factory(). See the end of the docs.
  • MultiVectors can now compare equal to scalars if they themselves are scalar.
  • MultiVectors can now be relationally compared with scalars if they themselves are scalar.
  • MultiVectors 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-term MultiVectors.
  • BREAKING: Swapped behaviors of v % grade and v[idxs] - they are now v % idxs and v[grade(s)] because [] notation denotes subscript more often.
  • MultiVector.terms now returns a tuple of single-term MultiVectors.
  • 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 a MultiVector, which means that all operations now do too.
  • repr(n * _) = '(' + repr(n) + ')' to distinguish it from n.
  • Since Blade is no more, repr(v) now *-multiples bases instead of swizzling them.
  • MultiVector.__pow__ no longer supports ternary pow() because modulo means index swizzling now.
  • Normalization is now done by MultiVector.__pos__ instead of __invert__.
  • math.fsum() is no longer used as it causes Decimals to lose precision by casting them to floats. If you need precision in addition, use Decimal.
  • MultiVector.rotate will now raise a TypeError if plane is not a basis.

0.1.1

30 Jun 07:46
Compare
Choose a tag to compare

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 runs doctest on the module and Markdown, with a non-zero exit status on failure.

Fixes

  • A couple of fixes in doctests.

0.1.0

30 Jun 02:43
Compare
Choose a tag to compare

New Features

  • multivectors.xy and from multivectors import xyz are now a thing (swizzling on the module level) but unlike class-level swizzling, invalid chars will cause an AttributeError (from multivectors import a would set a to 1.0 otherwise)
  • Blade.terms returns (blade,) for compatibility with MultiVector.terms
  • real @ blade is now supported
  • A ** -n = 1 / (A ** n)
  • real ^ blade is now supported
  • To better mimic regular floats, scalar blades can now be passed to complex(), int(), and arr[]
  • round(blade), math.trunc(blade), math.floor(blade), and math.ceil(blade) act on the scalar part, returning that times the bases
  • simple @ multivector is now supported
  • simple ^ multivector is now supported
  • round(multivector), math.trunc(multivector), math.floor(multivector), and math.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 chars
  • repr(Blade) uses repr() on its scalar again; %.2f is still used in str()
  • multivector ** -n is now explicitly rejected

Fixes

  • names_to_idxs() no longer fails on invalid chars between e and the digits of the number (enables e_1)
  • idxs_to_idxs() now always returns a list
  • str(Blade) used to return e0 for e1
  • blade @ non-simple now correctly fails
  • Fixed infinite recursion when Blade(scalar=x) / blade
  • blade ^ non-simple now correctly fails
  • blade ^ real no longer fails
  • Correction: abs(blade) is (blade * blade) ** .5, not blade.scalar
  • float(blade) can't return NotImplemented, so raise TypeError
  • multivector % grade now returns the blades, not just their scalars
  • MultiVector.angle_to() returns a real, not a MultiVector.
  • Noted in docstring of MultiVector.angle_to() that multivectors of singular grade 1 only are accepted

0.0.0

28 Jun 21:29
Compare
Choose a tag to compare

Initial release

  • Create the library