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))}$"))