Triple integral found sym ?
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(2 个)
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.
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))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!