From: Raymond T. <toy...@gm...> - 2022-01-10 19:18:30
|
On Sun, Jan 9, 2022 at 12:29 PM <ng...@gm...> wrote: > Sorry to interrupt the current thread of discussion. Here is a very simple > question related to Fourier series. I guess I am missing something very > basic either in Maxima or probably in theory - should the two curves not be > on top of each other? Many thanks, Thomas > > /* test Fourier representation in Maxima e.g. */; > > a:0.5*%pi; b:1.5*%pi; > > /* sin cos fourier series */; > > sincos(t):= a*sin(t) + b*cos(t)$ > > /* A phi fourier series */; > > A: sqrt(a^2+b^2); phi: -atan2(b,a); > > Aphi(t):= A*cos(t+phi)$ > > /* plot: expect sincos and Aphi to be on top */; > > pm: []$ pm: endcons(sincos(t),pm)$ pm: endcons(Aphi(t),pm)$ > > wxplot2d( pm, [t, 0., 2*%pi],grid2d )$ > Your Aphi function is not the same as sincos. You can see this with trigexpand(Aphi). I think your phi is backwards. I think you want -atan(a,b) because a is the sin factor so it's the y component and b is the cos factor so it's the x component. Making that change makes Aphi expand to sincos, as expected. > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > -- Ray |