1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Packages

From maxima

(Difference between revisions)
Jump to: navigation, search
m
Line 12: Line 12:
<br>(out2) false
<br>(out2) false
<br>(%i3) integrate(abs(a*x+b)^3,x);  /* you get a noun form */
<br>(%i3) integrate(abs(a*x+b)^3,x);  /* you get a noun form */
-
<br>(out3)  
+
<br>(out3)a^3*'integrate(x^3*signum(a*x+b)^3,x)+
-
<br>a^3*'integrate(x^3*signum(a*x+b)^3,x)+
+
<br>3*a^2*b*'integrate(x^2*signum(a*x+b)^3,x)+
<br>3*a^2*b*'integrate(x^2*signum(a*x+b)^3,x)+
<br>3*a*b^2*'integrate(x*signum(a*x+b)^3,x)+
<br>3*a*b^2*'integrate(x*signum(a*x+b)^3,x)+
<br>b^3*'integrate(signum(a*x+b)^3,x)
<br>b^3*'integrate(signum(a*x+b)^3,x)
-
<br>
 
<br>(%i4) load(pw);                  /* load pw.mac now and try again */
<br>(%i4) load(pw);                  /* load pw.mac now and try again */
<br>(out4) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/pw.mac"
<br>(out4) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/pw.mac"
Line 26: Line 24:
<br>(b^3*x+b^4/a)*signum(a*x+b)
<br>(b^3*x+b^4/a)*signum(a*x+b)
<br>(%i6) signum_to_abs(%);
<br>(%i6) signum_to_abs(%);
-
<br>(out6) (a^3*x^3+3*a^2*b*x^2+3*a*b^2*x+b^3)*abs(a*x+b)/(4*a)
+
<br>(out6)(a^3*x^3+3*a^2*b*x^2+3*a*b^2*x+b^3)*abs(a*x+b)/(4*a)
<br>(%i7) factor(%);
<br>(%i7) factor(%);
<br>(out7) (a*x+b)^3*abs(a*x+b)/(4*a)
<br>(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
(%i1) load(abs_integrate);
(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)
(%i4) load(pw); /* load pw.mac now and try again */
(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
(%i2) load(pw);
(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)
(%i4) load(abs_integrate); /* load abs_integrate now and try again */
(out4) "C:/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/integration/abs_integrate.mac"
(%i5) integrate(1/(abs(x-1)+abs(x)+1),x,-7,5);
(out5) log(16)/2+log(5)/2-log(2)/2+1/2
(%i6)

It might be best to have both packages loaded when you are working with piecewise functions.

Richard Hennessy

Personal tools