Ask Your Question

Why does integrate(f1(y)*f2(y),y) return an error but integrate(f1(t,y)*f2(t,y),y) works?

asked 2018-08-08 06:41:12 -0500

hausdorff gravatar image

updated 2018-08-08 09:38:36 -0500

Symbolic Integration works only with second dummy variable

Hi there,

I am trying get an symbolic expression for the convolution $$ (\psi \star f)(x) := \int\limits_{\mathbb{R}} \psi(x-y) f(y) {d y} $$

of two functions $ f, \psi: \mathbb{R} \to \mathbb{R} $ as follows:

psi = function('psi')(y)
f = function('f')(y)

upon which I get the error message

RuntimeError: ECL says: Error executing code in Maxima:

If I add an extra argument to the two functions and define them as $$ f, \psi : \mathbb{R} \times \mathbb{R} \to \mathbb{R} $$ as follows:

psi = function('psi')(t,y)
f = function('f')(t,y)

there is a surprise, it suddenly works! I get the desired symbolic expression on which I can run diff(..,x) and all the other built-in functions.

TL;DR Why does integrate(psi(y)*f(y),y) return an error?

What am I missing here ?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2018-08-09 04:14:03 -0500

Emmanuel Charpentier gravatar image

I think that's a bug in the Sage-to-maxima interface. Compare :

sage: var('y') 
....: psi = function('psi')(y) 
....: f = function('f')(y) 
sage: (psi(x-y)*f(y)).maxima_methods().integrate(y)
integrate(f(y)*psi(x - y), y)
sage: (psi(x-y)*f(y)).maxima_methods().integrate(y).diff(x)
integrate(f(y)*D[0](psi)(x - y), y)

with :

sage: (psi(x-y)*f(y)).integrate(y)

[ Long backtrace ]

RuntimeError: ECL says: Error executing code in Maxima:


sage: integrate(psi(x-y)*f(y),y, algorithm="sympy")
integrate(f(y)*psi(x - y), y)
sage: integrate(psi(x-y)*f(y),y, algorithm="sympy").diff(x)
integrate(f(y)*D[0](psi)(x - y), y)
sage: integrate(psi(x-y)*f(y),y, algorithm="giac")
integrate(f(y)*psi(x - y), y)
sage: integrate(psi(x-y)*f(y),y, algorithm="giac").diff(x)
integrate(f(y)*D[0](psi)(x - y), y)

Another exemple of this quirk (against an old saw by Leibnitz, IIRC) :

sage: foo=arctan(x).diff(x).subs(x^2==-p).maxima_methods().powerseries(p,0).subs
....: (p==-x^2).simplify(); foo
sum((-1)^i5*x^(2*i5), i5, 0, +Infinity)
sage: foo.maxima_methods().integrate(x)
sum((-1)^i5*x^(2*i5 + 1)/(2*i5 + 1), i5, 0, +Infinity)
sage: foo.integrate(x)

[ Long backtrace again... ]

RuntimeError: Encountered operator mismatch in maxima-to-sr translation

and integrate(foo, x) gives the same final error message.

I encounter the same problem (and the same "solution") in Trac#13071. Other integration Trac tickets may have a similar origin, (but I lack the time needed to check them...).

edit flag offensive delete link more

answered 2018-08-09 03:32:47 -0500

eric_g gravatar image

This is definitely a bug, which seems to originate from the name psi for one of the two functions: it is confused with Maxima's special function psi, see

If you replace psi by another name, everything works:

sage: f = function('f')
sage: g = function('g')
sage: y = var('y')
sage: integrate(g(x-y)*f(y), y)
integrate(f(y)*g(x - y), y)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-08-08 06:41:12 -0500

Seen: 41 times

Last updated: Aug 09