On 7 Apr 2009 , Edwin Woollett wrote:
---------------------
another example:
(%i1) (fpprintprec:8,display2d:false)$
(%i2) integrate(1/(x^2 - 1),x,0,2);
Principal Value
(%o2) log(%i)-log(3)/2-log(-1)/2
(%i3) float(%);
(%o3) log(%i)-1.5707963*%i-0.549306
(%i4) ldefint(1/(x^2 - 1),x,0,2);
(%o4) -log(3)/2
(%i5) float(%);
(%o5) -0.549306
(%i6) quad_qawc(1/(1+x),x,1,0,2);
(%o6) [-0.549306,1.51336373E-11,105,0]
--------------------------------------------
It is straightforward to use Maxima's
limit function to work out the principal
value integral from its basic definition:
/* indefinite integral */
(%i1) display2d:false$
(%i2) ix : integrate(1/(x^2-1),x);
(%o2) log(x-1)/2-log(x+1)/2
(%i3) ratsimp ( diff(ix,x) );
(%o3) 1/(x^2-1)
construct first piece function of eps
(%i4) i1 : ratsimp( subst(x=1 - eps,ix) - subst( x = 0,ix ));
(%o4) (log(-eps)-log(2-eps)-log(-1))/2
construct second function of eps
(%i5) i2 : ratsimp( subst(x=2,ix) - subst(x = 1 + eps,ix) );
(%o5) (log(eps+2)-log(eps)-log(3))/2
combine
(%i6) ip : logcontract( ratsimp ( i1 + i2 ) );
(%o6) -log(-(3*eps-6)/(eps+2))/2
take limit
(%i7) limit(ip, eps, 0, plus );
(%o7) -log(3)/2
(%i8) float(%);
(%o8) -0.54930614433405
Ted Woollett