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?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With