I'm working on solving differential equations through Fourier series, I made a function to help me calculate the coefficients that looks like this:
bn[α_, T_, f_] := (2/T)*Integrate[f*Sin[((2*Pi*n)/T)*t], {t, α, T + α}]
And it was workng pretty well, until I tried to evaluate this:
bn[0, L, Piecewise[{{0, 0 < t < L/3}, {w, L/3 < t < 2*(L/3)}, {0, 2*(L/3) < t < L}}]]
And it gives me the error:
Integrate::pwrl: Unable to prove that integration limits {L} are real. Adding assumptions may help. >>
Any idea on what is causing/how to avoid the error? I tried using assumptions, but I guess I'm doing it wrong because it doens't help.
bn[α_, T_, f_] :=
Integrate[(2/T)*f*Sin[((2*Pi*n)/T)*t], {t, α, α + T}, Assumptions -> Element[T, Reals]]
Edit
You mean enter the code like it is now? Sorry for the inconvenience, but the advanced help for the site sort of suggested that I used LaTeX.
f
. I will pick at this later. Thanks for the post and the edit. You will get response in time I expect. My initial thought is to add code to deal with the piecewise defined cases in pieces. $\endgroup$bn[-\[Pi], 2 \[Pi], \[Piecewise] { {-\[Pi], -\[Pi] < t < 0}, {\[Pi], 0 < t < \[Pi]} }]
It does give me the expected result, I get stuck when I try to use variable periodsT
. $\endgroup$