Integral from a function that has a singularity

조회 수: 2 (최근 30일)
Kurt Hakan
Kurt Hakan 2017년 1월 29일
댓글: Star Strider 2017년 1월 29일
Hello I want to take an integral from the function that has a singularity(pole), by quadgk but this common don't give a right answer .for instance an integral of the function 1/(x-1) from(-2,2) anyone can guide me thanks

채택된 답변

Star Strider
Star Strider 2017년 1월 29일
The best I can do is to rely on the Symbolic Math Toolbox, that came up with a piecewise result. Perhaps you can use this in your code:
syms x L U
f(x) = 1/(x-1);
intf = int(f,x, L, U)
intf =
piecewise(L <= 1 & 1 <= U, int(1/(x - 1), x, L, U), 1 < L | U < 1, log(U - 1) - log(L - 1))
The ‘L’ and ‘U’ variables are the lower and upper limits of integration, respectively.
  댓글 수: 6
Kurt Hakan
Kurt Hakan 2017년 1월 29일
thanks
Star Strider
Star Strider 2017년 1월 29일
As always, my pleasure.
Wolfram Alpha evaluates it using the Cauchy principal value

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by