Post Reply 
Gamma function, SinhIntegral, CoshIntegral
11-08-2022, 11:49 AM
Post: #7
RE: Gamma function, SinhIntegral, CoshIntegral
Good morning everyone,
since I have found that the latest version of my program about the Gamma function does not return a correct result when the arguments are made up of complex numbers, I made a change.
For safety, I also attach the program for the integral hyperbolic sine, for the integral hyperbolic cosine, and for the "Pochhammer symbol":

Shi(z):

Code:

#cas
// Shi(z) Sinh Integral z ∈ ℂ
Shi(z):=
BEGIN
IF type(z)==DOM_IDENT OR type(z)==DOM_SYMBOLIC
THEN RETURN 1/2*(Ei(z)-Ei(−z))+G_0;
END;
CASE
IF ARG(z)==0 OR ARG(exact(z))==pi THEN 
1/2*(Ei(z)-Ei(−z)) END;
IF 0<ARG(z)<pi THEN 1/2*(Ei(z)-
Ei(−z))-sqrt(-1)*pi/2 END;
DEFAULT 1/2*(Ei(z)-Ei(−z))+sqrt(-1)*pi/2
END;
END;
#end

Chi(z):

Code:

#cas
// Chi(z) → Cosh Integral
Chi(z):=
BEGIN
IF type(z)==DOM_IDENT OR type(z)==DOM_SYMBOLIC
THEN RETURN (G_0+Ei(-z)+Ei(z))/2+G_1;
ELSE
IF type(approx(z))==DOM_INT OR
type(approx(z))==DOM_FLOAT AND 
SIGN(approx(z))==1 THEN 
RETURN 1/2*Ei(-z)+1/2*Ei(z);
ELSE
IF type(approx(z))==DOM_INT OR
type(approx(z))==DOM_FLOAT AND
SIGN(approx(z))==-1 THEN
RETURN sqrt(-1)*pi+1/2*Ei(-z)+1/2*Ei(z);
ELSE
IF type(approx(z))==DOM_COMPLEX AND
SIGN(im(approx(z)))==1 THEN
RETURN (sqrt(-1)*pi+Ei(-z)+Ei(z))/2;
ELSE
IF type(approx(z))==DOM_COMPLEX AND
SIGN(im(approx(z)))==-1 THEN
RETURN ((−sqrt(-1))*pi+Ei(-z)+Ei(z))/2;
END;
END;
END;
END;
END;
END;
#end

Pochhammer(a,n):

Code:

#cas
Pochhammer(a,n):=
BEGIN
IF n==0 THEN
RETURN 1;
ELSE
RETURN product((a+j),j,0,n-1);
END;
END;
#end

Upper_Inc_Γ(a,z):

Code:

#cas
Upper_Inc_Γ(a,z):=
BEGIN
LOCAL funz, t,fnz;
// fnz:=(1/(-a)!)*(Shi(z)-Chi(z));
CASE
IF a==0 AND z==0 THEN
RETURN "Error: a==0 & z==0" END;
IF (type(a)==DOM_INT AND a>0) THEN
RETURN -z^a*integrate(t^(a-1)*e^(-t*z),t
,0,1)+Gamma(a) END;
IF (IM(a)≠0 AND type(a)==DOM_RAT)
 OR type(a)==DOM_COMPLEX THEN
RETURN subst(simplify(Gamma(a)-z^a*
e^(-z)*sum(z^k/(Pochhammer(a,k+1)),k,
0,n)),n,100.);
END;
IF (SIGN(z)==-1 AND type(a)==DOM_RAT)
 AND (a>0 OR a<−1) THEN
RETURN (Gamma(a,z)-Gamma(a))*(−1)^(a
-1)+Gamma(a) END;
IF type(a)==DOM_INT AND a≤0 THEN
RETURN (−1)^(-a)*((sum((k-1)!/(
(-a)!*(-z)^k),k,1,-a))*exp(-z)+
(1/(-a)!)*(Shi(z)-Chi(z))) END;
IF (SIGN(z)==-1 AND type(a)==DOM_RAT)
 AND (a<0 AND a>−1) THEN
RETURN (−z^(a)*exp(−z)+(
(Gamma(a+1,z)-Gamma(a+1))*(−1)^(a+1
-1)+Gamma(a+1)))/a END;
DEFAULT
RETURN Gamma(a,z);
END;
END;
#end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Gamma function, SinhIntegral, CoshIntegral - robmio - 11-08-2022 11:49 AM



User(s) browsing this thread: 1 Guest(s)