matlab integration using function
Show older comments
can i integrate this in matlab
integration of x^b/((1+x^b)^2) from 0 to infinity
1 Comment
Walter Roberson
on 21 Jul 2020
integral() with anonymous function that uses vectorized operations such as ./ and .^
Answers (1)
John D'Errico
on 21 Jul 2020
Edited: John D'Errico
on 21 Jul 2020
Um, no. And, yes. Sort of. Is that a good, definiitive answer? Depending on the value of b, this has a solution, or no solution at all.
Pick some fixed value of b. Say b == 2.
b = 2;
syms x
int(x^b/(1+x^b)^2,0,inf)
ans =
pi/4
Larger values of b yield a little less clean solutions.
b = 3;
int(x^b/(1+x^b)^2,0,inf)
ans =
(2*pi*3^(1/2))/27
b = 4;
int(x^b/(1+x^b)^2,0,inf)
ans =
(2^(1/2)*(4*pi - log(- 1/2 - 1i/2)*(1 + 1i) - log(- 1/2 + 1i/2)*(1 - 1i) + log(1/2 - 1i/2)*(1 - 1i) + log(1/2 + 1i/2)*(1 + 1i)))/32
vpa(ans)
ans =
0.27768018363489789
As you can see, when b == 4, I had to resort to just computing the numerical value itself to give a clean, simple looking result.
But when b == 1,
b = 1;
int(x^b/(1+x^b)^2,0,inf)
ans =
Inf
Here we see a problem arises. With a little thought you can even see whay this fails when b == 1.
For general b>1, the integral is not some simple function of b. For b <= 1, a solution does not exist.
And if your question would be, when b > 1, is there some simply written algebraic function of b that provides a general solution, the answer seems to be no. You could define this as a special function, give it a name, tablulate values, etc. For b > 1, the problem is well-posed. But that is about as much as you could do.
So, can you form the integral? Well yes and no. Sort of.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!