matlab not displaying an approximated value of an improper integral?
7 ビュー (過去 30 日間)
古いコメントを表示
I want to calculate an approximate value of an improper integral:
>> fun= 4./(x.*(1-x).*(2-x).*(pi.^2+(log(x./(1-x)).^2))
>> vpa(int(fun,0,1))
then matlab displays the result:
ans =
vpaintegral(4/(x*(log(-x/(x - 1))^2 + 2778046668940015/281474976710656)*(x - 1)*(x - 2)), x, 0, 1).
how can I get the approximate value of this improper integral? thanks in advance.
6 件のコメント
Dyuman Joshi
2023 年 8 月 23 日
I had an inkling because of the value but wasn't sure due to the format of the value -
sqrt(2778046668940015/281474976710656)
採用された回答
Nathan Hardenberg
2023 年 8 月 23 日
編集済み: Nathan Hardenberg
2023 年 8 月 23 日
Here are some ideas, but please still regard my comment.
- You have two variables x and p. You can not approximate numerically then.
- "To approximate integrals directly, use vpaintegral instead of vpa. The vpaintegral function is faster and provides control over integration tolerances." [source]
- Specify that you want to use x as your variable (int(fun, x, [a b]))
- You can not numerically approximate if your denomenator gets 0 at some point (see example below)
-- EDIT --
Your problem is nr. 4. Your denomenator gets 0 to fix this you can simply choose values close to 0 and 1. See example below:
syms x
p = pi; % edited to be p = pi
fun = 4./(x.*(1-x).*(2-x).*(p.^2+(log(x./(1-x)).^2)))
vpa(int(fun, 0.001, 0.999)) % choosing values slightly above 0 and below 1
But maybe this is not good enough, since the solution can get quite a bit different when getting closer to the limits:
vpa(int(fun, 1e-110, 1 - 1e-13)) % choosing tighter values
-- EDIT END --
% Example of nr. 4 from above
syms x
f = 1/x;
Fvpaint = vpaintegral(f,x,[0 1])
8 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!