# how to do double integration including symbolic ??

1 ビュー (過去 30 日間)
gourav pandey 2021 年 8 月 16 日
コメント済み: Walter Roberson 2021 年 8 月 16 日
clc;
clear;
close all;
syms theta omega1 P_t Q_t P_n Q_n Pc2 Pc3 Pc4 Ps2 Ps3 Ps4 Qc2 Qc3 Qc4 Qs2 Qs3 Qs4
a1=1;
h1=5;
temp=@(theta,omega1) -omega1.^2.*exp(-abs(omega1).*(cos(theta) + 5)).*((Qs2.*((28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (141110627044806525.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./18014398509481984 - (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./4503599627370496 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./18014398509481984) + Pc2.*((9407375136320435.*omega1.^(5./2).*((5.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./(2.*omega1.^(1./2)) + (2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./2))./18014398509481984 - (28222125408961305.*omega1.^(3./2).*((2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1))./2 + (3.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./(2.*omega1.^(1./2))))./18014398509481984 - (28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (28222125408961305.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./36028797018963968 + (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./18014398509481984 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./36028797018963968) + Q_n.*pi.*exp(-omega1).*((5.*omega1)./2 + 5./2) - (5.*pi.*P_t.*omega1.*exp(-omega1))./2)./omega1.^2 - (cos(theta) + 5).*((Qs2.*((28222125408961305.*omega1.^(3./2).*((5.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./(2.*omega1.^(1./2)) - (2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./2))./4503599627370496 + (28222125408961305.*omega1.^(1./2).*((2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./2 - (3.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./(2.*omega1.^(1./2))))./2251799813685248 + (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./18014398509481984 - (28222125408961305.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./18014398509481984) - (5.*pi.*P_t.*omega1.*exp(-omega1))./2 + (5.*pi.*Q_n.*omega1.*exp(-omega1))./2)./omega1 - (abs(omega1).*(Qs2.*((28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (141110627044806525.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./18014398509481984 - (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./4503599627370496 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./18014398509481984) + Pc2.*((9407375136320435.*omega1.^(5./2).*((5.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./(2.*omega1.^(1./2)) + (2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./2))./18014398509481984 - (28222125408961305.*omega1.^(3./2).*((2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1))./2 + (3.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./(2.*omega1.^(1./2))))./18014398509481984 - (28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (28222125408961305.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./36028797018963968 + (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./18014398509481984 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./36028797018963968) + Q_n.*pi.*exp(-omega1).*((5.*omega1)./2 + 5./2) - (5.*pi.*P_t.*omega1.*exp(-omega1))./2))./omega1.^2))
Fun = integral2(@(theta,omega1) (temp(theta,omega1).*cos(omega1.*a1.*sin(theta))),0,2*pi,0,inf)

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

### 採用された回答

Walter Roberson 2021 年 8 月 16 日
There is no possible way to use integral() or integral2() when the expression to be integrated includes unresolved symbolic variables. integral() and integral2() are strictly numeric integration.
The below may take a fair while. You can get through result_inner in a quite reasonable time, but the last step is not fast.
syms theta omega1 P_t Q_t P_n Q_n Pc2 Pc3 Pc4 Ps2 Ps3 Ps4 Qc2 Qc3 Qc4 Qs2 Qs3 Qs4
assume(theta >= 0 & omega1 >= 0)
a1=1;
h1=5;
temp_sym = simplify(str2sym('-omega1.^2.*exp(-abs(omega1).*(cos(theta) + 5)).*((Qs2.*((28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (141110627044806525.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./18014398509481984 - (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./4503599627370496 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./18014398509481984) + Pc2.*((9407375136320435.*omega1.^(5./2).*((5.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./(2.*omega1.^(1./2)) + (2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./2))./18014398509481984 - (28222125408961305.*omega1.^(3./2).*((2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1))./2 + (3.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./(2.*omega1.^(1./2))))./18014398509481984 - (28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (28222125408961305.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./36028797018963968 + (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./18014398509481984 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./36028797018963968) + Q_n.*pi.*exp(-omega1).*((5.*omega1)./2 + 5./2) - (5.*pi.*P_t.*omega1.*exp(-omega1))./2)./omega1.^2 - (cos(theta) + 5).*((Qs2.*((28222125408961305.*omega1.^(3./2).*((5.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./(2.*omega1.^(1./2)) - (2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./2))./4503599627370496 + (28222125408961305.*omega1.^(1./2).*((2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./2 - (3.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./(2.*omega1.^(1./2))))./2251799813685248 + (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./18014398509481984 - (28222125408961305.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./18014398509481984) - (5.*pi.*P_t.*omega1.*exp(-omega1))./2 + (5.*pi.*Q_n.*omega1.*exp(-omega1))./2)./omega1 - (abs(omega1).*(Qs2.*((28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (141110627044806525.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./18014398509481984 - (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./4503599627370496 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./18014398509481984) + Pc2.*((9407375136320435.*omega1.^(5./2).*((5.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./(2.*omega1.^(1./2)) + (2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./2))./18014398509481984 - (28222125408961305.*omega1.^(3./2).*((2.^(1./2).*omega1.^(1./2).*pi.^(1./2).*exp(-omega1))./2 + (3.*2.^(1./2).*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./(2.*omega1.^(1./2))))./18014398509481984 - (28222125408961305.*2.^(1./2).*pi.^(1./2).*exp(-omega1))./4503599627370496 + (28222125408961305.*2.^(1./2).*omega1.^2.*pi.^(1./2).*exp(-omega1).*(3./omega1 + 3./omega1.^2 + 1))./36028797018963968 + (84666376226883915.*2.^(1./2).*omega1.*pi.^(1./2).*exp(-omega1).*(1./omega1 + 1))./18014398509481984 - (9407375136320435.*2.^(1./2).*omega1.^3.*pi.^(1./2).*exp(-omega1).*(6./omega1 + 15./omega1.^2 + 15./omega1.^3 + 1))./36028797018963968) + Q_n.*pi.*exp(-omega1).*((5.*omega1)./2 + 5./2) - (5.*pi.*P_t.*omega1.*exp(-omega1))./2))./omega1.^2))'))
inner = (temp_sym.*cos(omega1.*a1.*sin(theta)))
inner_sym = simplify(inner)
result_inner = int(inner_sym, theta, 0, 2*pi)
result = int(result_inner, omega1, 0,inf)
##### 2 件のコメント表示非表示 1 件の古いコメント
Walter Roberson 2021 年 8 月 16 日
Maple says the result is 0.

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

### その他の回答 (1 件)

Matt J 2021 年 8 月 16 日

If you are integrating a symbolic expression, you should use int()
You should remove "@(theta,omega1)" from the definition of temp. It makes no sense to have it there if theta and omega1 are symbolic.
##### 1 件のコメント表示非表示 なし
gourav pandey 2021 年 8 月 16 日
theta and omega1 are function handle. Thank you Matt, i will do the changes. Thank you

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

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by