# [Maxima] Cauchy principal value integral

Edwin Woollett woollett at charter.net
Thu Apr 9 15:39:19 CDT 2009

``` On 4-8-09 Edwin Woollett wrote :
------------------------------------
> It is straightforward to use Maxima's
> limit function to work out the principal
> value integral from its basic definition:
---------------------------------------

It is quicker to use integrate in its definite
integral mode to get the definition of a principal value
integral, but you will need to answer questions
or else prep with an assume statement:

(%i1) display2d : false\$
(%i2) assume ( eps > 0, eps < 1 )\$

/* example 1:    1/x integrated over [-1, 2 ] */

(%i3) integrate ( 1/x, x, -1, -eps ) + integrate ( 1/x, x, eps, 2 );
(%o3) log(2)   /* success */

/*  the deftness of ldefint  */

(%i4) ldefint(1/x,x,-1,2);
(%o4) log(2)

/* the ineptness of integrate  */

(%i5) integrate(1/x,x,-1,2);
Principal Value
(%o5) log(2)+2*%i*%pi

/* example 2:   1/(x^2 - 1) over [0, 2]  */

(%i6) integrate(1/(x^2-1),x,0,1-eps) +
integrate(1/(x^2-1),x,1+eps,2);
(%o6) log(eps+2)/2-log(2-eps)/2-log(3)/2
(%i7) limit(%,eps,0,plus);
(%o7) -log(3)/2   /* success  */

/*  the deftness of ldefint  */

(%i8) ldefint(1/(x^2-1),x,0,2);
(%o8) -log(3)/2

/* the ineptness of integrate  */

(%i9) integrate(1/(x^2-1),x,0,2);
Principal Value
(%o9) log(%i)-log(3)/2-log(-1)/2
-----------------------------------------

These two principal value integrals  illustrate
the deftness of ldefint, and the ineptness of
integrate for principle value integrals. I suspect
that integrate is not using ratsimp and logcontract
correctly (see below for a possible wrong
path) and that ldefint is doing the job right.

(%i1) display2d:false\$

/*  indefinite integral for example 2  */

(%i2) ix : integrate(1/(x^2-1),x);
(%o2) log(x-1)/2-log(x+1)/2
(%i3) assume(eps>0, eps<1)\$

(%i4) i1 : subst(x=1 - eps,ix) - subst( x = 0,ix );
(%o4) log(-eps)/2-log(2-eps)/2-log(-1)/2

(%i5) i2 : subst(x=2,ix) - subst(x = 1 + eps,ix);
(%o5) log(eps+2)/2-log(eps)/2-log(3)/2

(%i6) ip : i1 + i2;
(%o6) log(eps+2)/2-log(eps)/2+log(-eps)/2-log(2-eps)/2-log(3)/2-log(-1)/2

we now take the limit without getting the log args
inside one log, and get an incorrect answer which reproduces
what integrate did above.

(%i7) limit(ip,eps,0,plus);
(%o7) log(%i)-log(3)/2-log(-1)/2

if we just do logcontract, still incorrect.

(%i8) logcontract(ip);
(%o8) log(eps+2)/2-log(eps)/2+log(-eps)/2-log(2-eps)/2-log(3)/2-log(-1)/2
(%i9) limit(%,eps,0,plus);
(%o9) log(%i)-log(3)/2-log(-1)/2

correct way: ratsimp, then logcontract:

(%i10) ratsimp(ip);
(%o10) (log(eps+2)-log(eps)+log(-eps)-log(2-eps)-log(3)-log(-1))/2
(%i11) logcontract(%);
(%o11) -log(-(3*eps-6)/(eps+2))/2
(%i12) limit(%,eps,0,plus);
(%o12) -log(3)/2
success.
==============

On 4-8-09 Michel Talon  wrote:
----------------------------------------------
> This integral doesn't exist, in the mathematical sense, period. You can
> find
> any real answer you want if you approach 0 in an unsymmetric way. The
> principal part prescription (approach 0 from right and left in a symmetric
> way) is a totally ad-hoc prescription which has no justification.

----------------------------------------
An integral with a "pole" on the contour does not exist in the
strict sense, but for a simple pole on the real axis, one defines the
Cauchy principal value of g(x) at a singular point c as
limit( integrate(g(x),x,a,c - eps) + integrate(g(x),x,c + eps,b )
,eps,0,plus).

If this limit exists, this definition provides a unique and well defined
result.

This result, well defined if it exists, does not imply that the integral is
"proper".

Michel is quite right that one does not need to resort to the work
of defining a principle value integral if a well defined  result involving
independent modes of approach using two parameters eps and epsprime via
the definition; (again see Gradshteyn \$ Ryzhik 7th, p. 252 )

limit(  limit( integrate(g(x),x,a,c - eps) +
integrate(g(x),x,c + epsprime, b ) ,eps,0,plus),
epsprime,0,plus )

is found.

Nevertherless, the principle value integral meaning is clear and well
defined.

Ted Woollett

```