SymPy integration, permanent

I cannot understand the behavior of the function sympy.integrate()

. The simplest example: integrate and differentiate:

t = sy.Symbol('t')
t1 = sy.Symbol('t1')
f = sy.Function('f')(t)
I = sy.integrate(f, (t, 0, t1))
f1 = I.diff(t1)
print f1

      

prints the following:

f(t1) + Integral(0, (t, 0, t1))

      

But I only expect to see f(t)

. The call f1.simplify()

doesn't help.

Why doesn't simplex soften the second term? How do you kill him?

+3


source to share


1 answer


You can call the method doit

:

>>> f1.doit()
f(t1)

      



I find SymPy is reluctant to do these operations automatically as they can be arbitrarily expensive and there is no universal system for predicting how expensive they are. But maybe it would be wise to add some heuristics for the integrals of 0 - I don't know. If you're interested in seeing this "fixed", you might consider opening an issue for it at http://github.com/sympy/sympy/issues

+1


source







All Articles