Question about abs_integrate




On Fri, 16 Apr 2010, Jaime Villate wrote:

< 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.
 
The problem appears to be that
integrate(signum(abs(x)),x,-2,2);
fails. I have filed a bug report.

You can extend f as an even function via
s(x,c):=(signum(x)+c)/2;

g(x):=s(x,1)*f(x) - s(x,-1)*f(-x);

then

integrate(g(x),x,-2,2);

yields 5/3.

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.