Hypergeometric Woes: 'Error:Inputs must be numeric arrays'
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hi !
I've previously asked a question along a similar lines, turns out I was misreading the expression I needed to evaluate.
I have to evaluate this integral in Python and am making a MATLAB function to test it.

(If you're intrigued, it's part of evaluating three electron quantum mechanical correlation, from this paper )
This is the code I'm using.
function the_sum = p_sum(L,M,N,alp,bet,gam)
syms p;
b = L+M+N+p+3;
c = L+M+p+3;
z = (alp+bet)/(alp +bet +gam);
constant = factorial(L)/((alp+bet +gam)^(L+M+N+3));
converging = factorial(L+M+N+p+2)/(factorial(L+1+p)*(L+M+2+p)) * ((alp/(alp + bet + gam))^p);
the_sum = symsum( constant * converging * hyp2f1(1,b,c,z),p,0,Inf);
end
And I get an error saying that my Inputs must be numeric arrays.
Error using hyp2f1 (line 13)
Inputs must be numeric arrays.
I tried doing this sum to begin to understand how the function works, but this seems to have flummoxed me even more !
This is only my second day using MATLAB, so I'm guessing my problem is rather obvious: I'd be very grateful for any help. As a secondary question, how can I get more numerical precision out of the hypergeometric function.
Answers (1)
Steven Lord
on 5 Mar 2020
0 votes
Is there a reason you're using the function from that File Exchange add-on rather than the hypergeom function in Symbolic Math Toolbox? You almost certainly have Symbolic Math Toolbox installed since you're using syms, unless you're using some other symbolic calculation add-on that has a function by that same name.
1 Comment
Charlie Hetherington
on 6 Mar 2020
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!