Hypergeometric functions(1F2) in matlab
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ALI
el 11 de Jun. de 2024
Comentada: Walter Roberson
el 11 de Jun. de 2024
I want to use the hypergeometric function [def] this exists in mathematica (wolfram). I tried this
function result = hypegeo(q, r)
qr = q * r;
z = - (qr)^2 / 4;
inp=[3/2,[1, 5/2],z];
F2_value = hypergeom(1,2,inp);
result = (1/3) * F2_value;
end
but for me looking at the definition of the hyper geometric function in matlab doesnt seem exaclty the same as the one in wolfram.
if they arent the same, is there a way to use mathmatica functions in matlab or some other workaround for this?
Respuesta aceptada
Walter Roberson
el 11 de Jun. de 2024
In MATLAB, some of the parameters are implicit according to the length of the other parameters.
function result = hypegeo(q, r)
qr = q * r;
z = - (qr)^2 / 4;
F2_value = hypergeom(3/2, [1, 5/2], z);
result = (1/3) * F2_value;
end
3 comentarios
Walter Roberson
el 11 de Jun. de 2024
No, mpmath.hyper accepts a, b, z parameters, where a and b are tuples. There is no hyper(a, b, c, z)
You should be using
a = 3/2;
b1 = 1;
b2 = 5/2;
z = -1*((q*r)^2)/4;
result_py = py.pyrun(mpmath.hyp1f2(a, b1, b2, z));
or something similar.
Más respuestas (1)
Shivani
el 11 de Jun. de 2024
You can refer to the following file exchange link for implementation details of calculating a generalized Hypergeometric function: https://www.mathworks.com/matlabcentral/fileexchange/5616-generalized-hypergeometric-function
Additionally, the following MATLAB Answer threads also provide details on implementing a Hypergeometric function in MATLAB.
- https://www.mathworks.com/matlabcentral/answers/570436-regularized-hypergeometric-function-1f2-within-matlab
- https://www.mathworks.com/matlabcentral/answers/91324-regularized-hypergeometric-function-and-hypergeometric-function-syntax
Hope this helps!
Ver también
Categorías
Más información sobre Call Python from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!