This morning I read a post at sage-devel group titled “Integral Functions”, and was really interesting.

For example, say you want to define a function as the primitive integral of another function,

,

`sage: var('x')`

sage: f = function('f',x)

sage: F = integral(f, x, 0, x)

sage: F.derivative(x)

gives an error… Why? derivative expect all parameters of to be symbols, and zero is an integer.

## Bypass

A sort of solution to this problem is giving a whole set of parameters to the limits, say,

`sage: var('x,a,b')`

(x, a, b)

sage: f = function('f',x)

sage: F = integral(f, x, a, b)

sage: F.derivative(x)

0

sage: F.derivative(a)

-f(a)

sage: F.derivative(b)

f(b)

Thus, it’s well defined for any case.

If you don’t give integration limits,

`sage: var('x')`

sage: f = function('f',x)

sage: F = integral(f, x)

sage: F.derivative(x)

f(x)

it work as expected.

The discussion page is HERE

Enjoy!

DOX

## Leave a Reply