필터 지우기
필터 지우기

integration of (1/x-x)^alpha

조회 수: 4 (최근 30일)
Camille
Camille 2014년 6월 11일
댓글: Camille 2014년 6월 11일
Hi,
here is my code
function y = f(r, alpha)
F = @(x) (1./x-x).^alpha;
y = integral(F,0,r);
end
Then if i type
f(1/2,0.2)
i get
ans =
0.707008459146274
but the problems start when alpha gets closer to 1, for example:
f(1/2, 0.8)
Warning: Infinite or Not-a-Number value
encountered.
> In funfun\private\integralCalc>iterateScalarValued at 349
In funfun\private\integralCalc>vadapt at 132
In funfun\private\integralCalc at 75
In integral at 88
In f at 3
ans =
Inf
How can I compute this integral? Thank you for reading

채택된 답변

Roger Stafford
Roger Stafford 2014년 6월 11일
Yes, you are right, Camille. If alpha < 1, your function is integrable, but the infinity in its integrand at x = 0 is apparently proving to be too difficult for matlab's 'integral' function to evaluate it properly.
However, if you make the following simple change of variable, you should encounter no such difficulty. To simplify notation use 'a' instead of 'alpha'. Define variable z as:
z = x^(1-a)
Then we have
dz = (1-a)/x^a*dx
and
(1/x-x)^a*dx = (1-x^2)^a/x^a*dx = (1-z^(2/(1-a)))^a/(1-a)*dz
Hence you should evaluate the integral
F = @(z) (1-z^(2/(1-a)))^a/(1-a);
y = integral(F,0,r^(1-a));
Matlab should have no trouble with this integral provided a < 1, since it has no singularities in its integrand.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2014년 6월 11일
1./1-1 yields a 0 and then 0 raised to any negative power is inf. What do you expect at 1?
  댓글 수: 1
Camille
Camille 2014년 6월 11일
Thank you for your response. The integral is well-defined for: 0 < r < 1 and alpha < 1 yet it won't compute when r=1/2 and alpha=0.8 (and in general when alpha gets too close to 1). So I'm looking for other means of computation.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by