Ask Your Question
0

Cauchy principal value integral

asked 2023-10-06 10:01:55 +0200

How can I calculate a Cauchy principal Value integral with sagemath

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2023-10-06 18:40:51 +0200

dan_fulea gravatar image

Use the definition, there is a limit, write explicitly the limit in sage.

For instance, $$\int_{-1}^1\frac{dx}x$$ makes no sense as it is, but we may want to compute instead $$ \text{PV}\int_{-1}^1\frac{dx}x =\text{PV}\int_{-1}^1\frac{dx}x := \lim_{a\searrow0}\text{PV}\int_{[-1,-a]\cup[a,1]}\frac{dx}x \ . $$ This can be easily implemented:

var('a,x')
assume(a>0);
assume(a<1);
limit( integral(1/x, x, -1, -a) + integral(1/x, x, a, 1), a=0 )

We get zero.

edit flag offensive delete link more
0

answered 2023-10-06 19:36:57 +0200

achrzesz gravatar image

Also:

from sympy import Integral
from sympy.abc import x
Integral(1/x, (x, -1, 1)).principal_value()
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-10-06 10:01:55 +0200

Seen: 74 times

Last updated: Oct 06 '23