The Symbolism library overloads arithmetic operators. Although it's written in C# I can use it from F#:
open Symbolism
let x = new Symbol("x")
let y = new Symbol("y")
let z = new Symbol("z")
printfn "%A" (2*x + 3 + 4*x + 5*y + z + 8*y)
the output:
3 + 6 * x + 13 * y + z
However, it also overloads ^ for powers. This of course doesn't play well with F#.
As a step towards a workaround, I exported a method group for powers:
printfn "%A" (Aux.Pow(x, 2) * x)
output:
x ^ 3
How can I overload ** to use the Aux.Pow method group instead?
I can do something like this:
let ( ** ) (a: MathObject) (b: MathObject) = Aux.Pow(a, b)
And that does work for MathObject values:
> x ** y * x;;
val it : MathObject = x ^ (1 + y)
But Aux.Pow is overloaded for int as well:
    public static MathObject Pow(MathObject a, MathObject b)
    { return new Power(a, b).Simplify(); }
    public static MathObject Pow(MathObject a, int b)
    { return a ^ new Integer(b); }
    public static MathObject Pow(int a, MathObject b)
    { return new Integer(a) ^ b; }
Any suggestions welcome!
 
     
     
    