I'm getting weird results from integrate in sympy using Heaviside. Here's my code:
import sympy as sp
x = sp.symbols('x')
L=1
def q(x): return (x-1/L)*sp.Heaviside(x-1/L)
def V(foo): return sp.integrate(q(x),(x,foo))
display(V(x))
If I run this, it works. But if I change L to, say, 2, it crashes. Why would this matter?
This is a bug but there is a way to work around it which is to explicitly rewrite as Piecewise:
Disabling the meijerg algorithm also gives a correct result: