Packages

(Difference between revisions)
 Revision as of 04:20, 28 April 2009 (view source)← Older edit Revision as of 04:22, 28 April 2009 (view source)m Newer edit → Line 12: Line 12:
(out2) false
(out2) false
(%i3) integrate(abs(a*x+b)^3,x);  /* you get a noun form */
(%i3) integrate(abs(a*x+b)^3,x);  /* you get a noun form */ -
(out3) +
(out3)a^3*'integrate(x^3*signum(a*x+b)^3,x)+ -
a^3*'integrate(x^3*signum(a*x+b)^3,x)+ +
3*a^2*b*'integrate(x^2*signum(a*x+b)^3,x)+
3*a^2*b*'integrate(x^2*signum(a*x+b)^3,x)+
3*a*b^2*'integrate(x*signum(a*x+b)^3,x)+
3*a*b^2*'integrate(x*signum(a*x+b)^3,x)+
b^3*'integrate(signum(a*x+b)^3,x)
b^3*'integrate(signum(a*x+b)^3,x) -

(out4) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/pw.mac"
(out4) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/pw.mac" Line 26: Line 24:
(b^3*x+b^4/a)*signum(a*x+b)
(b^3*x+b^4/a)*signum(a*x+b)
(%i6) signum_to_abs(%);
(%i6) signum_to_abs(%); -
(out6) (a^3*x^3+3*a^2*b*x^2+3*a*b^2*x+b^3)*abs(a*x+b)/(4*a) +
(out6)(a^3*x^3+3*a^2*b*x^2+3*a*b^2*x+b^3)*abs(a*x+b)/(4*a)
(%i7) factor(%);
(%i7) factor(%);
(out7) (a*x+b)^3*abs(a*x+b)/(4*a)
(out7) (a*x+b)^3*abs(a*x+b)/(4*a)

Revision as of 04:22, 28 April 2009

A brief comparison of the integration routines in the Maxima package "abs_integrate.mac" and the piecewise function package pw.mac (Pw.mac is not included in the current distribution but available from my site [1] under the GPL license.

pw.mac and abs_integrate.mac both can extend integrate to do piecewise functions. Some things abs_integrate.mac can not do but pw.mac can do and vica versa. Two examples:

Session 1
(out1) C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/integration/abs_integrate.mac
(%i2) display2d:false;
(out2) false
(%i3) integrate(abs(a*x+b)^3,x); /* you get a noun form */
(out3)a^3*'integrate(x^3*signum(a*x+b)^3,x)+
3*a^2*b*'integrate(x^2*signum(a*x+b)^3,x)+
3*a*b^2*'integrate(x*signum(a*x+b)^3,x)+
b^3*'integrate(signum(a*x+b)^3,x)
(out4) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/pw.mac"
(%i5) integrate(abs(a*x+b)^3,x);
(out5) (a^3*x^4/4-b^4/(4*a))*signum(a*x+b)+
(a^2*b*x^3+b^4/a)*signum(a*x+b)+
(3*a*b^2*x^2/2-3*b^4/(2*a))*signum(a*x+b)+
(b^3*x+b^4/a)*signum(a*x+b)
(%i6) signum_to_abs(%);
(out6)(a^3*x^3+3*a^2*b*x^2+3*a*b^2*x+b^3)*abs(a*x+b)/(4*a)
(%i7) factor(%);
(out7) (a*x+b)^3*abs(a*x+b)/(4*a)

New session:
(%i1) display2d:false;
(out1) false
(out2) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/pw.mac"
(%i3) pwint(1/(abs(x-1)+abs(x)+1),x,-7,5); /* you get a noun form */
(out3) 'integrate(1/(abs(x)+abs(x-1)+1),x,-7,5)