Efficient methods to calculate incomplete beta $B[a,b;x]$ for $b=0$

164 Views Asked by At

I am looking for an efficient numerical method (or a module) to calculate the incomplete $\beta-$function for $b=0$.

e.g. https://www.wolframalpha.com/input/?i=incomplete+beta%5B4%2F5%2C1.5%2C0.0%5D+

Most modules e.g. scipy.special.incbeta in Python run into problems because they try to calculate it via computing gamma[0] enter preformatted text here.

This is far from my domain of knowledge.

2

There are 2 best solutions below

0
On BEST ANSWER

"Efficient" depends on how much precision you need. Note $$B_x(a,b) = \int_{t=0}^x t^{a-1} (1-t)^{b-1} \, dt$$ so with $b = 0$ we have the series expansion $$B_x(a,0) = \int_{t=0}^x \sum_{k=0}^\infty t^{k+a-1} \, dt = \sum_{t=0}^\infty \frac{x^{k+a}}{k+a}.$$ If $a$ is a positive integer, this series can be computed exactly as the difference of a natural logarithm minus a finite number of terms. When $a$ is not a positive integer, then convergence is most rapid when $x$ is close to $0$. If $x$ is close to $1$, it is better to compute instead $$\begin{align*}B_x(a,0) &= \int_{t=0}^x \frac{1}{1-t} - \sum_{k=0}^\infty \binom{a-1}{k+1} (t-1)^k \, dt \\ &= -\log(1-x) - \sum_{k=0}^\infty \binom{a-1}{k+1} \frac{(-1)^k + (x-1)^{k+1}}{k+1}. \end{align*}$$ The number of terms needed depends on the desired precision, but in many cases, you do not need to compute a lot unless $a$ is extremely large, in which case the binomial series will converge slowly due to the oscillatory summand.

1
On

I faced this problem years ago and, since we had good mathematical subroutines, we decided to use $$B_x(a,0)=x^a \,\Phi (x,1,a)$$ which, for sure, is the same as what @heropup proposed with $\sum_{k=0}^\infty \frac{x^{k+a}}{k+a}$