Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Infix.ParseOrUndefined sequence order

I am using MathNet and trying to parse 2x^2 + x to epression using

Infix.Print(Infix.ParseOrUndefined("2x^2 + x"));

but it returns x + 2x^2. I want to keep the order of the source because I am going to convert it in LaTex using LaTeX.Print.

How can I keep the order when parsing equation?

like image 524
Renton Thurston Avatar asked Jan 27 '26 14:01

Renton Thurston


1 Answers

Keeping an arbitrary order is not possible, unfortunately. By design, in Math.NET Symbolics all expressions are always auto-simplified, and a systematic ordering is a crucial aspect of auto-simplification.

However, if this is more about ordering polynomials by descending exponent instead if an increasing one, or by applying some other systematic order relation at the point of printing the expression, it would certainly be possible to create such an alternative Infix.Print (or LaTeX.Print) implementation. After all, Infix.Print already does quite a few manipulations (other than Infix.PrintStrict).

like image 134
Christoph Rüegg Avatar answered Jan 30 '26 04:01

Christoph Rüegg