Regularized hypergeometric function 1F2 within matlab?

17 次查看(过去 30 天)
Hi, I'm trying to find the special function to use within my code:
function [result] = sin_derivatve(x,n)
if (rem(n,1) == 0) && (n ~= 0)
result = sin(x+n*pi()/2);
else
part1 = 2.^(n-1).*sqrt(pi()).*x.^(1-n);
part2 = hypergeom(1,[(1-n./2),(3/2-n./2)],-x.^2./4);
part3 = gamma([(1-n/2),(3/2 - n/2)]);
result = part1.*(part2./part3);
end
end
However, the hypergeom function above (part2) is 2F1 which is regulized by the gamma function (part3). Which means the matrix dimentions do not aline.
Is there a method to create a 1F2 Regularized hypergeometric function within matlab? Or another way to calculate the fractional derivative of sin(x)?
Thanks in advanced.

采纳的回答

David Goodmanson
David Goodmanson 2020-7-26
编辑:David Goodmanson 2020-7-26
Hi Wozciech,
if you add a prod function,
part3 = prod(gamma([(1-n/2),(3/2 - n/2)]))
then you're good to go. Or, you could use the gamma duplication formula to replace your current part1/part3
part1/part3 = x.^(1-n) * 2.^(n-1).*sqrt(pi) / (gamma(1-n/2)*gamma(3/2 - n/2))
with
part1/part3 = x.^(1-n) / gamma(2-n)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by