Fourier Series for unit step



"(if/then/else acts like a programming construct,
not a mathematical expression)"

I don't think there is a difference, we are just not there yet.  You can integrate a program sometimes.

Consider this case.

f(x,y):=
block
(
? ?c[-2]:0,c[-1]:0,c[0]:1,c[1]:0,
? ?for i: 2 thru 500 do (c[i]:(2*c[i-2]-y*3*c[i-4])/i),
? ?p:c[0],
? ?for i: 1 thru 500 do (p:p+c[i]*x^i),
? ?p
)$

expr1:diff(f(rat(x),rat(y)),y)$

bfloat((f(rat(1), rat(2.0001))-f(rat(1), rat(2)))/.0001);
-4.54926427472924b-1

bfloat(ev(expr1, x=rat(1),y=rat(2)));
-4.548979947844751b-1 

expr1:diff(f(rat(x),rat(y)),x)$



 ------------Original Message------------
From: "Stavros Macrakis" <macrakis at alum.mit.edu>
To: "Ismael Garrido" <ismaelgf at adinet.com.uy>
Cc: "Maxima List" <maxima at math.utexas.edu>
Date: Sun, May-11-2008 4:38 PM
Subject: Re: [Maxima] Fourier Series for unit step

On Sun, May 11, 2008 at 11:29 AM, Ismael Garrido <ismaelgf at adinet.com.uy> wrote:
>  If I define the function as f(x):= if x>0 then 1 else 0, then
>  totalfourier doesn't know how to integrate that....

Unfortunately, none of the standard Maxima mathematical routines
(integrate, diff, etc.) can do anything useful with if/then/else
expressions, even in the simplest cases:

    integrate(abs(x),x,0,1) => 1/2       <<< ok with abs when integrand >=0
    integrate(if x>=0 then x else -x,x,0,1)  (equivalent) => can't do it

In fact, not even Maxima simplification works correctly with
if/then/else expressions:

    expr: abs(q)$
    assume(q>0)$
    expand(expr) => q   resimplification takes assumption into account

    expr: if r=0 then r else -r$
    assume(r>0)$
    expand(expr) => unsimplified (doesn't take assumption into account)
    ev(expr) => r  (if/then/else acts like a programming construct,
not a mathematical expression)

This is certainly an area we want to improve in future versions.

             -s

PS Don't assume from the above that Maxima is brilliant with abs,
either!  For example, it can't do integrate(abs(x),x,-1,1).
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima