# Lazy evaluation of symbolic integration

I am confused by the output for the following code

var('x,u,w')

F(x)=integral((min_symbolic(u,0)-1/2)*exp(x*u),u,-1,1)
G(x)=F(x)
H(w)=F(w)

print("F:",F)
print("G:",G)
print("H:",H)


The output I am getting is

F: x |--> 1/2*integrate((2*min(0, u) - 1)*e^(u*x), u, -1, 1)
G: x |--> 1/2*integrate((2*min(0, u) - 1)*e^(u*x), u, -1, 1)
H: w |--> 1/2*(3*w*e^(-w) + 2*e^(-w) - 1)/w^2 - 1/2*(w*e^w + 1)/w^2


The output for H is what I am actually after, but I am wondering why it is different from the output for F and G, whether this is the intended behaviour and what is the official way to influence the evaluation/non-evaluation of such a symbolic integral expression.

Also this behaviour must have changed at some point in the recent past, breaking some of my existing code as a result.

edit retag close merge delete

This seems to result from the change of variable name :

sage: var('x,u,w')
(x, u, w)
sage: F(x)=integral((min_symbolic(u,0)-1/2)*exp(x*u),u,-1,1)
sage: G(w)=F(w)
sage: F
x |--> 1/2*integrate((2*min(0, u) - 1)*e^(u*x), u, -1, 1)
sage: G
w |--> 1/2*(3*w*e^(-w) + 2*e^(-w) - 1)/w^2 - 1/2*(w*e^w + 1)/w^2
sage: H(x)=F(x)
sage: H
x |--> 1/2*integrate((2*min(0, u) - 1)*e^(u*x), u, -1, 1)
sage: F(w)
1/2*(3*w*e^(-w) + 2*e^(-w) - 1)/w^2 - 1/2*(w*e^w + 1)/w^2


IMHO, it is a bug : the integral should be evaluated whatever the name. (And I have to check this integral...).

what is the official way to influence ...

(more)