mathnet-symbolics icon indicating copy to clipboard operation
mathnet-symbolics copied to clipboard

Cannot parse MathML

Open narem81 opened this issue 7 years ago • 6 comments

Hello, First of all, congratulations for Math.Net. It's a wonderful project. You've done a great job.

I'm trying to use Symbolics in a project where I need to parse a standard syntax in order to import expressions. I didn't find anything about LATEX parsing, but I found a method for parsing MathML: SymbolicExpression.ParseMathML. I tried to use it with some wellformed MathML code, but it always return undefined. What is the matter? Is something wrong in what I do?

Here is an example of MathML code I used <math display="block"> <mrow> <munderover> <mo>&#x2211;<!-- ∑ --></mo> <mrow> <mi>n</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi mathvariant="normal">&#x221E;<!-- ∞ --></mi> </munderover> </mrow> <mrow> <mfrac> <mn>1</mn> <msup> <mi>n</mi> <mn>2</mn> </msup> </mfrac> </mrow> <mo>=</mo> <mrow> <mfrac> <msup> <mi>&#x03C0;<!-- π --></mi> <mn>2</mn> </msup> <mn>6</mn> </mfrac> </mrow> </math>

Thanks in advance for any help.

narem81 avatar Oct 19 '17 10:10 narem81

For now abilities of Math.Net Symbolics pretty limited. May I ask what are you trying to do?

I'm not familiar with MathML language, so may you add some examples of input, which you want to parse, in naive or latex format?

FoggyFinder avatar Oct 19 '17 21:10 FoggyFinder

I have a client side tool that can handle either latex or mathml syntax to represent math functions. Therefore I need to handle such functions in the backend: recognize them, recognize variables and finally evaluate them.

Latex syntax would be better but mathml would be ok.

narem81 avatar Oct 19 '17 22:10 narem81

Any kind of functions should be available to the user that can write them and then save them as template.

narem81 avatar Oct 19 '17 22:10 narem81

Indeed, the problem in this particular case is that we don't even support series yet, nor the concept of locally-scoped symbols (the n in this case, which could be unrelated to an n outside of the series).

cdrnet avatar Oct 20 '17 06:10 cdrnet

Technically we could easily support them in the new visual expressions only, but supporting them in the (semantic) expressions will need some thoughts on design.

cdrnet avatar Oct 20 '17 06:10 cdrnet

Ok thank you for the answer. May I ask you the list of allowed mathml tags I can use in order to be parsed?

narem81 avatar Oct 23 '17 07:10 narem81