I am having the following problem.
using SymPy
@syms x y
f = -integrate(sin(y)/(abs(y)-PI)^3,(y,x,PI/6)) + integrate(cos(y-x)/(abs(y)-PI)^3,(y,x,PI/6)) + integrate(sin(y)*cos(y-x)/(abs(y)-PI)^3,(y,x,PI/6)) - integrate(1/(abs(y)-PI)^3,(y,x,PI/6)) + integrate(sin(y)*cos(y-x)/(abs(y)-PI),(y,x,PI/6))
f(PI/8).evalf() # a numerical value appears: OK
f(0).evalf() # a numerical value appears: OK
f(-PI/8).evalf() # it takes so long, and finally outputs a numerical value: why soo long?
g = 125*500/9*PI^3*(-integrate(sin(y)/(abs(y)-PI)^3,(y,x,PI/6)) + integrate(cos(y-x)/(abs(y)-PI)^3,(y,x,PI/6)) + integrate(sin(y)*cos(y-x)/(abs(y)-PI)^3,(y,x,PI/6)) - integrate(1/(abs(y)-PI)^3,(y,x,PI/6))) + 25*PI/3*integrate(sin(y)*cos(y-x)/(abs(y)-PI),(y,x,PI/6))
g(-PI/8).evalf() # it takes sooo long, and still no output at all
If I conduct each integration separately, then there is no such behavior described above.
What is the reason for this problem? And how to resolve it (if not decomposing the function f
or g
into several parts, then evaluating each part before taking sum).
Thank you.