Error trying to compute symbolic integral

2 ビュー (過去 30 日間)
abraham rodriguez
abraham rodriguez 2018 年 9 月 15 日
回答済み: Walter Roberson 2018 年 9 月 16 日
Im trying to evaluate the volume of a cone in cartesian coordinates, but somehow matlab is having trouble in evaluating the second integral, it shows a weird output with hypergeom and piecewise.
% code
syms x y z r h % radius r and height h
firstInt = int(1,z,h/r*sqrt(x^2+y^2),h);
SecondInt = int(FirstInt,y,-sqrt(r^2-x^2),sqrt(r^2-x^2));
ThirdInt = int(SecondInt,x,-r,r);

採用された回答

Walter Roberson
Walter Roberson 2018 年 9 月 16 日
What the output of SecondInt is telling you is that MATLAB is not able to find a closed form solution for the integral, except in the case where x = -1 or +1 in which case it can be expressed as a hypergeom.
There is actually a closed form solution for the second integral. And MATLAB can even compute one under reasonable circumstances:
syms x y real
syms z r h nonnegative % radius r and height h
FirstInt = int(1,z,h/r*sqrt(x^2+y^2),h);
SecondInt = int(FirstInt,y,-sqrt(r^2-x^2),sqrt(r^2-x^2));
ThirdInt = int(SecondInt,x,-r,r);
This will give you a closed form SecondInt involving log. You would get a numeric error if you evaluate this at x = 0 because one term would involve log(0), but the limit as x = 0 is not a problem.
Unfortunately if there is a closed form solution for ThirdInt then it is difficult to find.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by