Go to file
2019-07-12 09:43:40 +02:00
documentation Feat: Default render is txt 2019-07-11 10:36:35 +02:00
mapytex Fix: subtree render for tex 2019-07-11 18:03:49 +02:00
.gitignore Add venv to .gitignore 2018-08-30 07:11:48 +02:00
LICENSE Initial commit 2015-05-14 12:43:15 +02:00
pytest.ini pytest config 2018-03-15 16:38:06 +03:00
README.md Doc: fix \times instead of * 2019-07-12 09:43:40 +02:00
requirements.txt ci(python): Update requirements package version 2018-11-12 16:20:11 +01:00
setup.py Core: publish 2.0.8 version 2019-07-11 18:06:49 +02:00

Mapytex

Formal calculus with explanation python module.

French wiki

Installing

Install and update with pip

pip install -U mapytex

Examples

Simplify expressions and explain steps

>>> from mapytex import Expression
>>> ajout_fractions = Expression("2 / 5 + 2 / 3")
>>> resultat = ajout_fractions.simplify()
>>> print(resultat)
16 / 15 
>>> for s in resultat.explain():
...      print(s)
...
2 / 5  + 2 / 3 
2 * 3 / 5 * 3  + 2 * 5 / 3 * 5 
6 / 15  + 10 / 15 
6 + 10 / 15 
16 / 15 

Random expression generator

>>> from mapytex import Expression
>>> ajout_fraction = Expression.random("{a} + {b} / {c}")
>>> print(ajout_fraction)
2 + 3 / 5 

Render in latex

>>> from mapytex import Expression
>>> Expression.set_render("tex")
>>> ajout_fractions = Expression("2 / 5 + 2 / 3")
>>> for i in ajout_fractions.simpliy().explain():
...      print(i)
...
\frac{ 2 }{ 5 } + \frac{ 2 }{ 3 }
\frac{ 2 \times 3 }{ 5 \times 3 } + \frac{ 2 \times 5 }{ 3 \times 5 }
\frac{ 6 }{ 15 } + \frac{ 10 }{ 15 }
\frac{ 6 + 10 }{ 15 }
\frac{ 16 }{ 15 }