Skip to content

Commit

Permalink
fix: fix imports in vector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CallumJHays committed Jul 2, 2023
1 parent 837bc46 commit f7b4a9a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mathpad/vector.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

from typing import Generic, Sequence, Union, Any, TypeVar
from typing import Generic, Sequence, Union, Any
from typing_extensions import Self

from sympy.physics.vector import vlatex
from sympy.vector import Dot, Vector
from sympy.vector import Dot, Vector as SympyVector
from sympy import MatrixSymbol, Matrix, MatrixExpr, Expr, Derivative, Function

from mathpad.val import DimensionError, SumDimensionsMismatchError, Val, Q
from mathpad.vector_space import VectorSpaceT
from mathpad.equation import Equation

__all__ = ["Vector"]

class Vector(Generic[VectorSpaceT]):
"""
Expand Down Expand Up @@ -298,7 +299,7 @@ def __getattr__(self, name: str) -> Val:
f" (base names are {self.space.base_names})"
)

class Cross(Vector):
class Cross(SympyVector):
"""
A custom Cross product class that works with matrices instead of vectors.
Also gets rid of some weird negation behaviour (see sympy.vector.vector.Cross's __new__ method)
Expand All @@ -323,8 +324,6 @@ def doit(self, **hints):
return self._expr1.dot(self._expr2, **hints) # type: ignore


VecT = TypeVar('VecT', bound=Vector)

def _broken_rtruediv(self: Vector[Any], other: Q[Val]):
"Make it obvious that this is impossible, but don't let the type checker know this method is implemented"
assert isinstance(other, Vector), f"Can only divide vectors by vectors. Got {other} / {self}"
Expand Down

0 comments on commit f7b4a9a

Please sign in to comment.