Skip to content

Commit

Permalink
Fixed #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
tBuLi committed Apr 30, 2024
1 parent 429ad4a commit 4da76b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kingdon/multivector.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,16 @@ def sub(self, other):
__sub__ = sub

def __rsub__(self, other):
return other + (-self)
return self.algebra.sub(other, self)

def div(self, other):
return self.algebra.div(self, other)

__truediv__ = div

def __rtruediv__(self, other):
return self.algebra.div(other, self)

def __str__(self):
if not len(self.values()):
return '0'
Expand Down
5 changes: 5 additions & 0 deletions tests/test_kingdon.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,3 +816,8 @@ def test_mv_times_func():
assert y @ x == yfunc @ x
assert x >> y == x >> yfunc
assert y >> x == yfunc >> x

def test_43():
alg = Algebra(2)
x = alg.vector(name='x')
assert x.inv() == 1 / x

0 comments on commit 4da76b7

Please sign in to comment.