Analytic integration and differentiation with MathML
Code: "symbolic4.py". Programming language: Python DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/symbolic4_1373.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


# S.Chekanov

from jhplot.math import * 
from jhplot import *
from java.awt import Color

j=Symbolic("jscl") # using jscl engine

print "Differentiate="
ans=j.expand("d(cos(f(x)),x)") # output "-f'(x)*sin(f(x))"
print ans
 
print "Integrate="
print j.expand("integral(tan(a+b*x),x)") ==  "-1/b*log(4*cos(a+b*x))"
print j.simplify(j.expand("integral((x^4 + 2*x^2 + 2*x + 1) / x^3, x)")) == "-(1+4*x-x^4-4*x^2*log(x))/(2*x^2)"

s= j.expand("integral(tan(a+b*x),x)") 
print "Answer=",s
print "MathML form=",j.toMathML(s)

You see the box below because you did not login.