| 1 | initial version |
You can define $f$ in terms of the Heaviside function and then integrate directly without any imports. Try this code:
f(x) = heaviside(x-pi/2)
def c(n):
return integral(f(x)*exp(-I*n*x), (x,-pi,pi))
for n in range(0,40):
show(html(f"$c_{{{n}}}={latex(c(n))}$"))
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.