Incomplete Gamma Function of the Second Kind
05-25-2021, 10:26 PM (This post was last modified: 05-25-2021 10:50 PM by toml_12953.)
Post: #1
 toml_12953 Senior Member Posts: 2,038 Joined: Dec 2013
Incomplete Gamma Function of the Second Kind
I'm trying to compute the Gamma function by computing the incomplete gamma function of the first kind and the second kind and adding them together.

(no jokes about Close Encounters of the Third Kind, please! )

The first kind computes with no problem but the second kind gives me an error:

It doesn't use any trig functions that I can see so why the error? I know it does work in radian mode but I'm trying to understand what's happening.

Code:
EXPORT γ(A,X) BEGIN   RETURN approx(int(T^(A-1)*e^(-T),T,0,X)); END; EXPORT Γ(A,X) BEGIN   RETURN approx(int(T^(A-1)*e^(-T),T,X,∞)); END; EXPORT Γ(A) BEGIN   RETURN approx(γ(A,30) + Γ(A,30)); END;

Tom L
Cui bono?
05-26-2021, 12:32 AM
Post: #2
 Albert Chan Senior Member Posts: 2,231 Joined: Jul 2018
RE: Incomplete Gamma Function of the Second Kind
(05-25-2021 10:26 PM)toml_12953 Wrote:  "This function works only in radian mode Error: Bad Argument Value"

It doesn't use any trig functions that I can see so why the error?

Depending on user input, CAS might not recognize it related to gamma function.
It may tried to remove infinity by substitution, x = tan(t), so that x→∞ map to t→pi/2

CAS> gamma1(a,x) := int(t^(a-1)*e^-t, t=x .. inf)

CAS> gamma1(1, i) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → e^-i
CAS> gamma1(1.0, i) ﻿ ﻿ ﻿ → integrate(tan(t)^0.*e^(-tan(t))*(1+tan(t)^2), t, atan(i), π/2)

Actually, x=tan(t) here just shift the infinity ... atan(i)

Does atan(i) even have a limit ? CAS seems to think it is just a value.

CAS> limit(atan(x),x=i) ﻿ ﻿ ﻿ → ATAN(i)

Ref: DLMF: Chapter 8 Incomplete Gamma and Related Functions
 « Next Oldest | Next Newest »