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