Hypergeometric Woes: 'Error:Inputs must be numeric arrays'

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
The Hypergeometric function I'm using comes from this module:
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)

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

I'm afraid it wasn't clear to me how to set the p, q orders of the function to get the gaussian so I thought it would be just best to download something where it did what it 'says on the tin'.

This question is closed.

Tags

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!