diff --git a/mapytex/calculus/core/MO/mo.py b/mapytex/calculus/core/MO/mo.py index ad3c9a1..4902f31 100644 --- a/mapytex/calculus/core/MO/mo.py +++ b/mapytex/calculus/core/MO/mo.py @@ -255,6 +255,19 @@ class MOstr(MO): def variable(self): return self._variable + @property + def coefficients(self): + """ Dictionnary of coefficients + + :example: + >>> p = MOstr("x") + >>> p.coefficients + {1: } + """ + + return {1: MOnumber(1)} + + # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: diff --git a/mapytex/calculus/core/MO/monomial.py b/mapytex/calculus/core/MO/monomial.py index d461f45..392677b 100644 --- a/mapytex/calculus/core/MO/monomial.py +++ b/mapytex/calculus/core/MO/monomial.py @@ -66,6 +66,19 @@ class MOstrPower(MO): MO.__init__(self, _tree) + + @property + def coefficients(self): + """ Dictionnary of coefficients + + :example: + >>> p = MOstrPower("x", 2) + >>> p.coefficients + {2: } + """ + + return {self.power.value: MOnumber(1)} + @property def variable(self): return self._variable @@ -150,6 +163,18 @@ class MOMonomial(MO): def coefficient(self): return self._coefficient + @property + def coefficients(self): + """ Dictionnary of coefficients + + :example: + >>> p = MOMonomial(3, "x", 2) + >>> p.coefficients + {2: } + """ + + return {self.power.value: self._coefficient} + @property def strpower(self): if self._power == 1: