# Defining Cauchy principal value in MATLAB (or Scilab/Maple)?

How to define a variable which is an integral involving cauchy principal value inside in any computer programming language? I want to know how to break down the procedure step by step from a computational science viewpoint.

This is the integral I encounter: $S(\omega') = \int_0^\infty d \omega \frac{1}{\omega} \left( \mathcal{P} \left( \frac{1% }{\omega' - \omega} \right) + \mathcal{P} \left( \frac{1}{\omega' + \omega} \right) \right) \$

The LHS is a function of w'. The RHS is a function of w'. For example, x(t) = 2t+1 defines the variable x in terms of t. t = 1 means x = 3. For example in Matlab:

t = 1;
x = 2t + 1;


Now I want to define the variable S in terms of w'. For example,

w' = 1;
S = 2w' + 1; %<----(*) But what is S in terms of w' in my question?


then S = 3 here. But it is not such a simple expression here. I need the expression of S or set up the integral on the R.H.S so I can get the expression of S in terms of w' like in line (*). For example in Matlab, is it needed to do it using sym (symbolic) or do I have to do it by fourier transform fourier?

Note that the R.H.S is a definite integral of w. But since it will disappear, w' is the only variable of S here.

Or to cut off the question into parts of just defining Cauchy principal value. I browse in matlab documentation http://www.mathworks.com/help/symbolic/int.html

int(1/(x - 1), x, 0, 2, 'PrincipalValue', true) is what I encountered. But now I am not calculating improper integral. I want to define the Cauchy principal value of $$\frac{1}{x}$$ as in complex analysis and distribution. i.e. $$P\left(\frac{1}{x}\right) = \lim_{\varepsilon\rightarrow 0^+} \left[\int_a^{b-\varepsilon} 1/x\,\mathrm{d}x+\int_{b+\varepsilon}^c 1/x\,\mathrm{d}x\right]$$.

Related question: Sokhotski–Plemelj theorem

You can do it in maple like this.

First you need to specifiy the lower and upper limits. a, b, and c.

For normal/primitive integration, we use

int(1/x, x = a .. c);


Now to find the Cauchy Principal Value, there is built-in option in maple int,

int(1/x, x = a .. c, 'CauchyPrincipalValue');


But if you actually want type in yourself then

Limit(Int(1/x, x = a .. b-epsilon)+Int(1/x, x = b+epsilon .. c), epsilon = 0, right);