Open dharmatech opened 7 years ago
Here's a simple Mathematica evaluation:
Note that l[f[x]] // Simplify returns the same expression as m[x] // Simplify.
l[f[x]] // Simplify
m[x] // Simplify
Here's the equivalent in Symbolics/C#:
Expression f(Expression x) => 2 - x; Expression g(Expression x) => 2 / x; Expression h(Expression x) => f(g(x)); Expression l(Expression x) => g(h(x)); Expression m(Expression x) => h(h(x)); { var x = Expression.Symbol("x"); Console.WriteLine(Infix.Format(Rational.Simplify(x, l(f(x))))); Console.WriteLine(Infix.Format(Rational.Simplify(x, m(x)))); }
It outputs the following:
(2 - x)/(1 - x) (-2 + x)/(-1 + x)
Is there a simplification routine in Symbolics which will simplify both cases to the same expression?
Thanks!
(PS: I've been experimenting a bit with Symbolics in C# and its a really nice system. Thanks Christoph!)
I don't think we have anything simple to use, but agree that we should normalize (on Simplify - not automatic simplification). A rule could be that the leading coefficient of the numerator shall be positive.
Here's a simple Mathematica evaluation:
Note that
l[f[x]] // Simplify
returns the same expression asm[x] // Simplify
.Here's the equivalent in Symbolics/C#:
It outputs the following:
Is there a simplification routine in Symbolics which will simplify both cases to the same expression?
Thanks!
(PS: I've been experimenting a bit with Symbolics in C# and its a really nice system. Thanks Christoph!)