kill(all)$

maxima:programming How to use load(abs_integrate),version 1,2022
peter.vlasschaert@gmail.com,11/07/2022

use : integrate,defint,package : load(abs_integrate).
------------------------------------------------------------------

used : abs() inside integral.

→ constraint : n

declare(n,integer)$

assume(n>0);

rem : assume always has global declaration in Maxima
→( local , global) used with in a block statement.

example : symmetric integration interval, (-L≤ x≤ L), L=2

pb1:integrate(1/2*abs(x)*cos(%pi*n*x/2),x,-2,2);

defint(1/2*abs(x)*cos(%pi*n*x/2),x,-2,2);

load(abs_integrate)$

p1:pb1=integrate(1/2*abs(x)*cos(%pi*n*x/2),x,-2,2);

p1a:factor(ratsimp(rhs(p1)));

p2:pb1=defint(1/2*abs(x)*cos(%pi*n*x/2),x,-2,2);;

p2a:factor(ratsimp(rhs(p2)));

check relation : 
f(x) = abs(x) ,-2 ≤ x ≤ 2
1e) integral : sub-interval = (-2≤ x≤ 0)
2e) integral : sub-interval = (0≤ x≤ 2)

p3:args(args(pb1)[1]);

p3a:1/2*subst([abs(x) =-x],p3[1]);

p3b:1/2*subst([abs(x) =x],p3[1]);

1e) integral
---------------

p4a:integrate(p3a,x,-2,0);

2e) integral
---------------

p4b:integrate(p3b,x,0,2);

integral = 1e) integral + 2e) integral 
-----------------------------------------------

p4c:factor(ratsimp(p4a+p4b));

check : true,false

p5a:is(p1a=p4c)$
p5b:is(p2a=p4c)$
p5c:[p5a,p5b];

-------------------------------------------------------------------------------------------------------------------------------------