Incorrect results from hypergeom function in MATLAB R2018a.
이전 댓글 표시
In view of the following exact result:
2F1(1-n,1+n;3/2;1/2) =sin(nπ/2)/n
one would expect the result:
hypergeom([1−n,1+n],1.5,0.5)=0 if n is even.
However, for n=300, Matlab R2018a yields:
hypergeom([1−n,1+n],1.5,0.5)=Inf.
Why does this happen?
댓글 수: 3
Can you share a picture of the result, along with the code?
FYI, the results in R2023b are as follows -
n=300;
%numeric function
hypergeom([1-n,1+n],1.5,0.5)
%symbolic function
hypergeom(sym([1-n,1+n]), sym(1.5), sym(0.5))
Manikanta Aditya
2024년 3월 24일
Mostly the issue here is due to the limitations of numerical precision and the way 'hypergeom' function handles larger inputs.
In your case, when n=300, the parameters of the hypergeom function become very large ([1−300,1+300]), which can lead to numerical instability and might result in MATLAB returning Inf.
If you need to compute the hypergeometric function for large parameters, you might need to use more specialized numerical methods or software that can handle such cases.
Thanks!
yann
2024년 3월 24일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Just for fun에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!