There is a way to do this problem with pw.mac.
Since f(abs(x)) is a piecewise function you can use the piecewise() function to do this.
piecewise([minf, f(-x), 0, f(x), inf],x);
then pwint() can do this integral.
pwint(%,x,-2,2);
-> 5/3
I think that there should be a better way without using the piecewise() function (at least in this case). pwsimp()
should be able to transform f(abs(x)) into another equivalent form that pwint() can handle.. That's a bug I guess, it
is at least a weakness in pwsimp() that can be fixed but I am not sure how hard it would be to change pwsimp() so it can
do this.
FWIW,
Rich
--------------------------------------------------
From: "Jaime Villate" <villate at fe.up.pt>
Sent: Friday, April 16, 2010 4:03 PM
To: "Maxima" <maxima at math.utexas.edu>
Subject: Question about abs_integrate
> Hi,
> consider a function that is x^2 between 0 and 1, and 2-x, between 1 and
> 2:
> f(x) := ( x^2 + (2-x) + signum( x - 1 )*( (2-x) - x^2 ) )/2$
>
> with abs_integrate we can compute the integral:
> load("abs_integrate")$
> integrate ( f(x), x, 0, 2); ---> 5/6
>
> We now want to extend f to x from -2 to 0, as an even function:
> g(x) := f( abs( x ) )$
>
> Or to define a periodic function with period 2:
> h(x) := f( mod( x, 2 ) )$
>
> Since abs_integrate can integrate abs(x), I was expecting abs_integrate
> to give 5/3 at least for the first of the two integrals:
> integrate ( g(x), x, -2, 2);
> integrate ( h(x), x, -2, 2);
>
> but it fails to calculate any of those.
>
> Regards,
> Jaime
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>