integral method gives an answer of zero
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I have been trying compute
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1343444/image.png)
where β is a fixed constant. My code consists of the following:
k = 1.380649*10^(-23);
t = 5800;
beta = (k*t)^(-1);
fun = @(x) x.^3 ./ (exp(beta .* x) - 1);
q = integral(fun,0,Inf)
This results in the integral being evaluate as 0. However, I know that this integral is infact not zero over the domain ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1343449/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1343449/image.png)
Am I making somekind of mistake?
0 个评论
采纳的回答
Walter Roberson
2023-4-2
The values are so small relative to your constants that they might as well be zero.
With your beta being 1/(k*t) you are ending up with some large exponents in the exp() -- large enough that you are going to overflow numerically.
syms x
Q = @(v) sym(v);
k = Q(1380649)*Q(10)^(-29);
t = Q(5800);
beta = (k*t)^(-1);
fun = x.^3 ./ (exp(beta .* x) - 1)
int(fun, 0, Inf)
vpa(ans)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!