Clear Filters
Clear Filters

Regularized hypergeometric function 1F2 within matlab?

7 views (last 30 days)
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.

Accepted Answer

David Goodmanson
David Goodmanson on 26 Jul 2020
Edited: David Goodmanson on 26 Jul 2020
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)

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!