3

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?

TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

1

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).

Christoph Rüegg
  • 4,626
  • 1
  • 20
  • 34
  • (I could help providing such a variant) – Christoph Rüegg Oct 04 '15 at 19:08
  • I see. thank you. i guess I'll explain my goal. I am creating a simple calculator of definite and indefinite integral in calculus and I want to display it in LaTex, the user's input and the result, which is in MathNet Library and also MathNet.Symbolics is capable of Expanding equation such as `(2x^2 +x)^2` to `x^2 + 4x^3 + 4x^4`. thoug I'm still struggling on equation with function as 'sin(x)' because it has to be differentiate first. I'm sorry if it is off topic. – Renton Thurston Oct 04 '15 at 23:16
  • Yes, maybe it is easier to discuss this in our forum at http://discuss.mathdotnet.com/. Feel free to open a topic there in the Math.NET Symbolics category. – Christoph Rüegg Oct 05 '15 at 05:53
  • Thank you. Maybe it is better to discuss it there. – Renton Thurston Oct 05 '15 at 11:17
  • For reference: http://discuss.mathdotnet.com/t/math-net-symbolics-keeping-the-order/70 – Christoph Rüegg Oct 05 '15 at 14:08