How get the values of pdf function Beta

a bit for fun I tried to get the results also in the following ways


using QuadGK
a,b=5,3
integral, err = quadgk(t -> t^(a-1)*(1-t)^(b-1), 0, 1, rtol=1e-20)
# (0.009523809523809523, 0.0)
using SpecialFunctions
beta(5,3) # 0.009523809523809535


using Integrals
f(t,p) = p*t^4*(1-t)^2
p=1
prob = IntegralProblem(f, 0, 1, p)
sol = solve(prob) # u: 0.009523809523809523

setprecision(60, base=10) # use 60-digit arithmetic

integral, err = quadgk(t -> t^(a-1)*(1-t)^(b-1), big"0.0", big"1.0", rtol=1e-50)
# (0.0095238095238095238095238095238095238095238095238095238095238286, 9.7234613716580339174126000840314441259222690136268236454704947e-63)


beta(5,3) ≈ integral #true
beta(5,3) ≈  factorial(4)*factorial(2)/factorial(7) #true
beta(5,3) ≈ gamma(5)*gamma(3)/gamma(8) #true

# "≈" can be typed by \approx<tab>
1 Like