Post Reply 
fourier series coefficients.
10-26-2024, 04:23 AM
Post: #1
fourier series coefficients.
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.


Attached File(s) Thumbnail(s)
               
Find all posts by this user
Quote this message in a reply
10-26-2024, 07:41 PM
Post: #2
RE: fourier series coefficients.
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)
Find all posts by this user
Quote this message in a reply
10-27-2024, 06:25 AM
Post: #3
RE: fourier series coefficients.
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.
Find all posts by this user
Quote this message in a reply
10-27-2024, 07:08 AM
Post: #4
RE: fourier series coefficients.
Much better workaround:
fourier_an(piecewise(x<-pi/2,-2,x<pi/2,2,-2),n)
Find all posts by this user
Quote this message in a reply
10-28-2024, 05:14 AM
Post: #5
RE: fourier series coefficients.
Yes. Agreed. I'll be able to adapt that code. Thanking you again.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)