definite integral not giving exact answer

4 ビュー (過去 30 日間)
AgentWindu
AgentWindu 2020 年 1 月 15 日
コメント済み: AgentWindu 2020 年 1 月 16 日
Hi,
I have a triple integral with the following code:
inner_int=int(r*sin(phi),phi,[acos(4/5) pi-acos(4/5)])
middle_int=int(inner_int,r,3,5)
Mass_S=int(middle_int,theta,0,2*pi)
The answer I get from the first line is
-r*(cos(175787564848171/70368744177664) - cos(181129459610871/281474976710656))
When it should be 8/5*r
I have tried adding 'IgnoreAnalyticConstraints',true to the end of int but it didn't work. Is there anything I can do to get MATLAB to compute this as an exact solution. For reference the shape to be integrated is a sphere with a cylindircal hole drilled in it and spherical coordinates are required. Thanks

採用された回答

Steven Lord
Steven Lord 2020 年 1 月 15 日
Compute your limits of integration symbolically to avoid roundoff error.
f = sym(4)/5;
a = acos(f);
inner_int = int(r*sin(phi), phi, [a, pi-a])
  1 件のコメント
AgentWindu
AgentWindu 2020 年 1 月 16 日
Great
Thanks for your help, this worked

サインインしてコメントする。

その他の回答 (1 件)

Cameron B
Cameron B 2020 年 1 月 15 日
編集済み: Cameron B 2020 年 1 月 15 日
I don't know what the issue is. I did this and got 8*r/5. The answer seems to be correct.
syms r
sym(-r*(cos(175787564848171/70368744177664) - cos(181129459610871/281474976710656)))

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by