Skip to content
leerobertPublic

About

Converts presentation Math ML to sympy

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mml2sympy

A simple package for converting presentation math ML into sympy expressions.

Example

>>> from mml2sympy import mml2sympy
>>> mml = '''
...         <math xmlns="http://www.w3.org/1998/Math/MathML">
...           <mstyle displaystyle="true">
...             <mn> 2 </mn>
...             <mi> x </mi>
...             <mo> - </mo>
...             <mn> 4 </mn>
...             <mo> = </mo>
...             <mn> 7 </mn>
...           </mstyle>
...         </math>
...     '''
>>> expression_strings = mml2sympy(mml)
>>> expression_strings
["Eq(Add(Mul(Integer(2),Symbol('x'),),Integer(4),),Integer(7))"]
>>> from sympy import *
>>> expressions = [sympify(s, evaluate=False) for s in expression_strings]
>>> expressions
[Eq(2*x + 4, 7)]

Supports

Currently supports Add, Mul, Eq for sympy. Supports msup, mtable (one row support currently, no matrices, etc), mfrac, msqrt, mi, mn, mo.

About

Converts presentation Math ML to sympy

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages