diff --git a/mapytex/calculus/core/MO/monomial.py b/mapytex/calculus/core/MO/monomial.py index ede5a68..0ecc764 100644 --- a/mapytex/calculus/core/MO/monomial.py +++ b/mapytex/calculus/core/MO/monomial.py @@ -114,15 +114,21 @@ class MOMonomial(MO): self._power = _power if self._power == 1: - _tree = Tree("*", - self._coefficient, - self._variable - ) + if self._coefficient == 1: + _tree = self._variable + else: + _tree = Tree("*", + self._coefficient, + self._variable + ) else: - _tree = Tree("*", - self._coefficient, - MOstrPower(self._variable, self._power) - ) + if self._coefficient == 1: + _tree = MOstrPower(self._variable, self._power) + else: + _tree = Tree("*", + self._coefficient, + MOstrPower(self._variable, self._power) + ) MO.__init__(self, _tree) diff --git a/mapytex/calculus/core/MO/polynomial.py b/mapytex/calculus/core/MO/polynomial.py index ad9c3c6..602e7f7 100644 --- a/mapytex/calculus/core/MO/polynomial.py +++ b/mapytex/calculus/core/MO/polynomial.py @@ -33,6 +33,8 @@ class MOpolynomial(MO): >>> MOpolynomial('x', {0: 1, 3: 4}) + >>> MOpolynomial('x', {0: 1, 3: 1}) + """ diff --git a/mapytex/calculus/core/typing/__init__.py b/mapytex/calculus/core/typing/__init__.py index 648c543..7c56f73 100644 --- a/mapytex/calculus/core/typing/__init__.py +++ b/mapytex/calculus/core/typing/__init__.py @@ -11,7 +11,7 @@ Computing with MO """ from .exceptions import TypingError -# from .add import add +from .add import add # from .minus import minus # from .multiply import multiply from .divide import divide @@ -27,7 +27,7 @@ from tabulate import tabulate MOS = [ MOnumber, MOstr, MOFraction, MOstrPower, MOMonomial ] OPERATIONS = { - # "+": add, + "+": add, # "-": minus, # "*": multiply, "/": divide,