I am new to Prolog, having to write a symbolic differentiation tool for Calculus class. I have it working in such a way that:
?- diff(ln(x^3),D).
D = 1*3*x^(3-1) / x^3 ;
and:
?- diff(x*x*x*x,D).
D = x*x*x*1+x*(x*x*1+x*(x*1+x*1)).
Works, however, I would prefer to have it as:
D = 3x^(-2) / x^3;
and:
D = 4x^(3);
Is there a simple way to simplify these mathematical expressions. Thanks!