Fourier Series using fourie.mac



Rafa? Topolnicki pisze:
> Leo Butler pisze:
>>
>> On Mon, 27 Jul 2009, Rafa? Topolnicki wrote:
>>
>> < Hi,
>> < < During testing Fourier Series Expansion in maxima I found a 
>> problem I < can't cope with.
>> < < (%i3)                            load(fourie)
>> < (%o3)         /usr/share/maxima/5.18.1/share/calculus/fourie.mac
>> < (%i4)                         f(x) := abs(sin(x))
>> < (%o4)                         f(x) := abs(sin(x))
>> < (%i5)                    flist : fourier(f(x), x, %pi)
>> <                                           2
>> < (%t5)                              a  = ---
>> <                                      0   %pi
>> < <                       cos(%pi n)   cos(%pi n)      1         1
>> <                    2 (---------- - ---------- + ------- - -------)
>> <                        2 n + 2      2 n - 2     2 n + 2   2 n - 2
>> < (%t6)        a  = -----------------------------------------------
>> <                n                         %pi
>> <  
>> The easiest thing to do would be to add a line
>>
>> %t6 : a[n] = if n=1 then 'limit( subst(n=_n,rhs(%t6)),_n,n ) else
>> %rhs(%t6);
>>
>> This should probably be caught by fourexpand.
>>
>> Leo
>>
>>
> i'm afraid it's doesn't. I still get the same error
> (%i8) %t6:a[n] = if n=1 then 'limit(subst(n=_n,rhs(%t6)),_n,n) else 
> %rhs(%t6);
>                           cos(%pi n)   cos(%pi n)      1         1
>                        2 (---------- - ---------- + ------- - -------)
>                            2 n + 2      2 n - 2     2 n + 2   2 n - 2
> (%o8)   a  = %rhs(a  = -----------------------------------------------)
>          n         n                         %pi
> (%i9) fourexpand(flis,x,%pi,1);
> 
> first argument not a list
> #0: fourexpand(l=flis,x=x,p=%pi,nn=1)(fourie.mac line 180)
>  -- an error.  To debug this try debugmode(true);
> 
> 
> the same when instead of 'limit(subst(n=_n,rhs(%t6)),_n,n) I type simply 0.
> 
> RT
> 
> 
of course there should be
(%i9) fourexpand(flist,x,%pi,1);

Division by 0
#0: fourexpand(l=[%t5,%t6,%t7],x=x,p=%pi,nn=1)
  -- an error.  To debug this try debugmode(true);


RT