From: Majzoub, E. <eri...@um...> - 2024-03-14 21:08:44
|
Hi All. I ran into a problem calculating fourier coefficients for a simple square wave. Define a square wave, odd about the origin: f(x) := 2*unit_step(x) -1 ; load(abs_integrate); load(fourie); foursimp( fourier(f(x),x,1) ); # calculate it on the interval (-1,1). This gives zeros for all the coefficients. The problem seems to be with the behavior of the unit_step() function. (%i33) oddfunp(f(x),x); (%o33) false Tracing the call gives: 1 Enter oddfunp [- 1 + 2 unit_step(x), x] 1 Enter equalp [- 1 + 2 unit_step(x), 1 - 2 unit_step(- x)] 1 Exit equalp false I don't know where this is best fixed. In the fourie.mac code? PS. Note that there is another package on github called "pdefourier" that can use the f(x) defined above and returns the correct answer, also using abs_integrate. -Eric |