Reputation: 773
I want to integrate the equation:
f(x) = integral(E^(-i * omega * t)), from
-a
toa
.
I wrote the following code:
from sympy import *
from sympy.abc import a, omega, t
init_printing(use_unicode=False, wrap_line=False, no_global=True)
f = E**(-I * omega * t)
integrate(f, (omega, -a, a))
But the result is just the entered definite integral. When I change the integrally limits to 0
to a I
get a result... Does anyone know how to get a solution from -a
to a
?
Many thanks in advance.
John
Upvotes: 9
Views: 17415
Reputation: 1565
Sympy does not know about all the things you assume about your variables, so you need to tell sympy explicitly. For example a
is supposed to be a positive (and hence real) number. If I tell this to sympy, then I get a nice answer. Try
a = symbols('a', positive=True)
right before
integrate(f, (omega, -a, a))
And make sure you use a sufficiently recent version of sympy. 1.0 works for me.
Upvotes: 13