# How can I integrate this function?

3 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Star Strider
on 2 Apr 2023

Edited: Star Strider
on 2 Apr 2023

The function as presented appears to be a bit ambiguous, so I’m not certain which (if either) of these is correct.

That aside, the result is NaN with an infinite upper limit for both of them —

p = @(r,K,B) 0.5*(r./(2*K*B)).^((K-1)/2) .* exp(-(r+2*K*B)/2) .* besseli(K-1,sqrt(2*K*B*r));

K = 2;

B = 1;

b = rand

Result = integral(@(r)p(r,K,B), b, 1E5)

.

##### 7 Comments

Torsten
on 2 Apr 2023

Note that the r is still outside the exponentiation in your definition of p.

Star Strider
on 2 Apr 2023

Fixed. I was staring so intently at the LaTeX expression that I overlooked that.

### More Answers (1)

Walter Roberson
on 2 Apr 2023

Assuming the the posted formula is correct in having the exp() raised as an exponent to the (r/2KB) then:

Because you want to integrate to r = infinity, examine your p(r) as r increases towards infinity.

exp(-(r+2KB)/2) as r increases towards infinity heads to exp(-infinity) which head towards 0 from above.

That 0-limit is being multiplied by a constant (K-1)/2 which continues to give the 0-limit.

That 0-limit is the exponent of r/(2*K*B) and so that limit would be r^0 which would be limit-1 -- a non-zero constant

The leading 1/2 is a positive multiplicative constant, and a positive constant times a limit-constant gives a positive constant in the limit.

Thus as r goes to infinity the part of the expression before the besseli goes to positive constant.

Now, the integration of a positive constant out to infinity is infinity, so if we ignore the besseli for the moment, we see we are at risk of an infinite outcome of the integral.

When would the true integral potentially be below infinity? Only if the besseli() portion goes towards zero. But for real-valued constant nu, besseli(nu, x) increases without bound with increasing x. And sqrt(2*K*B*r) is strictly increasing in increasing r.

Therefore, if the exp() is properly part of the exponent of (r/2KB) then the integral of p as r goes to infinity is going to be infinite.

... Now if the exp() should not be part of the exponent, if it should be at the same baseline as the (r/2KB) then the analysis would be notably different.

##### 1 Comment

Torsten
on 2 Apr 2023

Assuming the the posted formula is correct in having the exp() raised as an exponent to the (r/2KB)

It doesn't seem to be the case:

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!