1
0
Fork 0
Datei suchen
Bertrand Benjamin 7f8939eab2
continuous-integration/drone/push Build is passing Details
Test: separate expression build and showing it
2020-08-21 19:07:34 +02:00
documentation Feat: Default render is txt 2019-07-11 10:36:35 +02:00
mapytex Test: separate expression build and showing it 2020-08-21 19:07:34 +02:00
.drone.yml Feat: add autopublishing 2020-08-20 17:02:09 +02:00
.gitignore Feat: start using nox 2020-08-20 16:59:40 +02:00
LICENSE Initial commit 2015-05-14 12:43:15 +02:00
README.md Mise à jour de 'README.md' 2020-07-18 06:29:21 +00:00
noxfile.py Feat: start using nox 2020-08-20 16:59:40 +02:00
pytest.ini pytest config 2018-03-15 16:38:06 +03:00
requirements.txt ci(python): Update requirements package version 2018-11-12 16:20:11 +01:00
setup.py Feat: return value for random_list 2020-08-20 20:50:54 +02:00

README.md

Mapytex

Build Status

Formal calculus with explanation python module and exercises creation tools.

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 }

Statistical tools

>>> from mapytex import Dataset
>>> d = Dataset.random(10, "Poids des sacs (kg)", "gauss", (4, 1), v_min=1)
>>> print(d)
[3.03, 5.94, 4.46, 2.58, 5.32, 3.22, 5.75, 4.22, 1.81, 4.71]
>>> d.mean()
4.1
>>> d.effectif_total()
10
>>> d.sum()
41.04
>>> print(d.tabular_latex(2))
\begin{tabular}{|c|*{5}{c|}}
    \hline
    3.03 & 5.94 & 4.46 & 2.58 & 5.32 \\
    \hline
    3.22 & 5.75 & 4.22 & 1.81 & 4.71 \\
    \hline
\end{tabular}

>>> w = WeightedDataset([1, 2, 3, 4], "Enfants", [10, 11, 12, 13])
>>> print(w)
{1: 10, 2: 11, 3: 12, 4: 13}
>>> print(w.tabular_latex())
\begin{tabular}{|c|*{4}{c|}}
\hline
    Enfants & 1 & 2 & 3 & 4 \\
    \hline
    Effectifs & 10 & 11 & 12 & 13 \\
    \hline
\end{tabular}