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!