symbolic integration with undefined variable

2 ビュー (過去 30 日間)
james hopper
james hopper 2014 年 9 月 17 日
コメント済み: james hopper 2014 年 9 月 17 日
i created the following script code
syms r,x,r,z; a=int((r^2*x*z)/(r^2+z^2)^(3/2),0,2*pi) b=int(a, r, 0, r)
because i can't do definite integrals of multidimensional problems. But the answer for b is not making sense to me as i keep getting this piecewise answer that does not make sense. It appears that its trying to evaluate the value of z over which answer is valid. how can i force it to know that z is always a positive value > 0 so i can avoid this?
here is what i get out, note a is correct, but b is confused.
a = (2*pi^2*r^2*z)/(r^2 + z^2)^(3/2)
b = piecewise([z in {-1, 1}, (2*pi^2*r^3*z*hypergeom([3/2, 3/2], [5/2], -r^2))/3], [not z in {-1, 1}, int((2*pi^2*r^2*z)/(r^2 + z^2)^(3/2), r, 0, r)])

採用された回答

David Sanchez
David Sanchez 2014 年 9 月 17 日
Point out that z>0 like this:
>> assume(z>0);
>> b=int(a, r, 0, r)
b =
-2*pi^2*z*(log(z) - log(r + (r^2 + z^2)^(1/2)) + r/(r^2 + z^2)^(1/2))
  1 件のコメント
james hopper
james hopper 2014 年 9 月 17 日
Thanks. That's just what I needed!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by