fourier series coefficients. - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: fourier series coefficients. (/thread-22580.html) |
fourier series coefficients. - truble@mill - 10-26-2024 04:23 AM I'm using fourier_an and fourier_bn. Results are unreliable. Result is often 'undef'. See attached. an_setup_1 shows setup for cosine coefficients. an_setup_2 shows result. Undef. an_setup_help_page shows Prime help suggestions. fourier_bn working example shows typical results expected. BTW, fourier_an results should be +/- 8/n*pi for n odd and 0 for n even. Can anyone explain my error? Thank you. RE: fourier series coefficients. - parisse - 10-26-2024 07:41 PM The CAS can only handle integration of piecewise with one linear inequation. Workaround: rewrite your expression under this constraint. For example fourier_an(-2+4*piecewise(x>-pi/2,1,0)*piecewise(x<pi/2,1,0),n) RE: fourier series coefficients. - truble@mill - 10-27-2024 06:25 AM Thank you for your reply. It certainly works but I do not follow your workaround. Could you add some explanation? For example, why you decided x>-pi/2 and what the other parameters are inside the piecewise function. Thanking you. RE: fourier series coefficients. - parisse - 10-27-2024 07:08 AM Much better workaround: fourier_an(piecewise(x<-pi/2,-2,x<pi/2,2,-2),n) RE: fourier series coefficients. - truble@mill - 10-28-2024 05:14 AM Yes. Agreed. I'll be able to adapt that code. Thanking you again. |