# [Maxima] Fourier Series for unit step

Stavros Macrakis macrakis at alum.mit.edu
Sun May 11 15:38:52 CDT 2008

```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).
```