# [Maxima] Can't integrate function

Richard Hennessy rich.hennessy at verizon.net
Sun Apr 11 14:33:25 CDT 2010

```This is a piecewise function, Maxima has no built in way to integrate piecewise functions.  I have a package on this
site called pw.mac that can integrate piecewise functions continuous or not.

The site is http://mysite.verizon.net/res11w2yb/id2.html

There is a lot of examples there and a help file.  You cannot integrate "if then else's" but you can rewrite you
functions using the piecewise() function that is contained in pw.mac.  Then you can integrate it with pwint().

Rich

--------------------------------------------------
From: "Soares Guerra" <soares.nguerra at gmail.com>
Sent: Sunday, April 11, 2010 11:31 AM
To: "Richard Fateman" <fateman at cs.berkeley.edu>
Cc: "Maxima List" <maxima at math.utexas.edu>
Subject: Re: [Maxima] Can't integrate function

> sorry, i forgot tho send the expression va(t):=if t>-3/2 and t<-1 then
> va2(-t) elseif t>-1 and t<0 then va1(-t)
> elseif t>0 and t<1 then va1(t) elseif t>1 and t<3/2 then va2(t);
>
> i need to have Vaaux, since vi(t), is only one periode, and i need to
> expand my period. So i didi is create anothet function that reples my
> vi, to both sides.
>
>
> 2010/4/11 Richard Fateman <fateman at cs.berkeley.edu>:
>> Soares Guerra wrote:
>>>
>>> hello to all,
>>>
>>> i Would like to know why maxima doesn't integrate the following function.
>>>
>>>
>>> a0:2/T*integrate(vi(t),t,-T/2,T/2);
>>>
>>> vi(t):=VAaux(t)+vb(t);
>>>
>>> VAaux(t):=if t<-T/2 then VAaux(t+T) elseif t<T/2 then va(t) else
>>> VAaux(t-T);
>>>
>>> vb(t):=1/4*cos(15*%pi*t)-1/8*sin(30*%pi*t);
>>> _______________________________________________
>>> Maxima mailing list
>>> Maxima at math.utexas.edu
>>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>>
>>
>> Maybe it has to do with computation with ranges of integration, conditional
>> expressions,
>> and the fact that you have not defined va(t).
>>
>> It seems to me that your expression simplifies to
>> 2/T*integrate(va(t),t,-T/2,T/2)
>> +
>> 2/T*integrate(vb(t),t,-T/2,T/2).
>>
>> The second part is easily integrated.
>>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>

```