Triple integral found sym ?

2 次查看(过去 30 天)
DM
DM 2014-11-19
评论: DM 2014-11-19
I am trying to perform a numerical triple integral over s, gamma1, gamma2. The limits are (-inf +int) (0,+inf) and (gamma1,+inf) respectively.
The following is my code
syms s
syms gamma1
syms gamma2
fun=-(exp(-(28035689158432973*pi*gamma2^(2/3))/2305843009213693952)*exp(-(pi*s*7120816246010697*i)/112589990684262400)*(1/((pi*s*(4194304/gamma1^2 + 4194304/gamma2^2)*i)/(50*(6144/gamma1 + 6144/gamma2)) + 1)^((3*(2048/gamma1 + 2048/gamma2)^2)/(4194304/gamma1^2 + 4194304/gamma2^2)) - 1)*(exp(-(pi^2*s*(log((-(gamma2*25*i)/(1024*pi*s))^(1/3) + 1)/3;
y=@(s,gamma1,gamma2)fun;
gamma2min=@(s,gamma1) gamma1;
prob=integral3(y,-inf,+inf,0,+inf,gamma2min,+inf)
I get the following error
Error using integralCalc/finalInputChecks (line 511) Input function must return 'double' or 'single' values. Found 'sym'.
Any advice?
Thank you very much!

回答(2 个)

Roger Stafford
Roger Stafford 2014-11-19
Matlab's error message has told you what one difficulty is. Your input function is returning 'sym' values because you declared s, gamma1, and gamma2 as of type 'sym', and 'integral' expects a numeric type, 'double' or 'single'. You should eliminate the 'syms' declarations.
Also I notice that there are fractional powers of quantities such as
(-(gamma2*25*i)/(1024*pi*s))^(1/3)
where the 1/3 power can yield any one of three possible results. You need to resolve any such ambiguities, or you may get results other than what you expect.
  1 个评论
DM
DM 2014-11-19
Thanks, what are the three possible results, you mentioned?

请先登录,再进行评论。


MA
MA 2014-11-19
fist of all your function hasn't written correct syntactically, then you can use this code:
syms s gamma1 gamma2
y=f(s,gamma1,gamma2);
prob=double(int(int(int(y,gamma2,gamma1,+inf),gamma1,0,+inf),s,-inf,+inf))
  1 个评论
DM
DM 2014-11-19
The function is not integrable symbollically, this is why I chose to do it numerically. I dont think I can use the int function as you provided.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by