I want to simplify the following expression so that I can encode it in the Stan language.
$$ D(t)=\frac{b^a}{\Gamma[a]} \int_0^t \tau^{a-1} e^{-\left(b-m\right)\tau} d\tau $$
$a, b, m, t$ are all non-negative reals, $a<0$, and $\Gamma$ is the gamma function $\Gamma[a] = \int_0^{\infty}x^{a-1}e^{-x}dx$. I'm using $D$ to model the number/mass of bacteria in my population.
I simplified the above integral as follows by multiplying by 1 twice.
$$ \begin{align} D(t) &= \frac{b^a}{\Gamma[a]} \int_0^t \frac{\left(b-m\right)^{a-1}}{\left(b-m\right)^{a-1}} \tau^{a-1} e^{-\left(b-m\right)\tau} \frac{\left(b-m\right)}{\left(b-m\right)} d\tau \\ &=\frac{1}{\Gamma[a]} \left(\frac{b}{b-m}\right)^{a} \int_0^t \left(\left(b-m\right)\tau \right)^{a-1} e^{-\left(b-m\right)\tau} \left(b-m\right) d\tau \\ &=\frac{1}{\Gamma[a]} \left(\frac{b}{b-m}\right)^{a} \int_0^{u(t)} u^{a-1} e^{-u} du \\ &=\frac{1}{\Gamma[a]} \left(\frac{b}{b-m}\right)^{a} \Gamma \left[ a, 0, u(t) \right] = \left(\frac{b}{b-m}\right)^{a} \gamma \left[ a, 0, (b-m) t \right] \end{align} $$ where $\Gamma [a, 0, j]=\int_0^j \tau^{a-1} e^{-\tau} d\tau$ is the lower incomplete gamma function and $\gamma [a, 0, j]=\frac{\Gamma [a, 0, j]}{\Gamma[a]}$ is the regularized lower incomplete gamma function. I used $u(t) = (b-m)t$ to get the integral to match the definition of $\Gamma [a, 0, j]$.
Luckily, the Stan function library contains the regularized lower incomplete gamma function, gamma_p. Unfortunately, gamma_p does not handle cases when the integration limit $x$ is $<0$, which happens for me when $b < m$. In this case, gamma_p would need to yield complex numbers, I believe. Also, the $\left(\frac{1}{b-m}\right)^{a}$ term is complex too when $b<m$. Yet I wish to fit (real) data that arises from this physically meaningful situation when $b<m$.
I don't know how to prove it, but I sense that my original integral expression for $D$ was always real when $a>0$ and $b, m, t \ge 0$, and I only introduced complex numbers when I multiplied by $\frac{\left(b-m\right)^{a}}{\left(b-m\right)^{a}}$. So, when I take the real part of the final expression, the expression behaves as I would expect (at least when I plot in WolframAlpha). (Are these statements true?)
My main question is how to write $$\Re\left[\left(\frac{b}{b-m}\right)^{a} \gamma \left[ a, 0, (b-m) t \right]\right]$$ (or, alternatively, $\int_0^t \tau^{a-1} e^{-\left(b-m\right)\tau} d\tau$ ) in terms of real-valued functions that are in Stan's function library, where $a, b, m, t$ are non-negative reals, $a>0$, and $b < m$.
I have not taken complex analysis but I have gotten as far as $$\begin{align} D(t) &= \Re\left[\left(\frac{b}{b-m}\right)^{a} \gamma \left[ a, 0, (b-m) t \right]\right] \\ &= \Re\left[\left(\frac{b}{b-m}\right)^{a}\right] \Re\left[\gamma \left[ a, 0, (b-m) t \right]\right] - \Im\left[\left(\frac{b}{b-m}\right)^{a}\right] \Im\left[\gamma \left[ a, 0, (b-m) t \right]\right] \\ &= \frac{1}{\Gamma[a]} \left| \frac{b}{b-m} \right| ^{a} \bigl( cos(\pi a) \Re\left[\Gamma \left[ a, 0, (b-m) t \right]\right] - sin(\pi a) \Im\left[\Gamma \left[ a, 0, (b-m) t \right]\right] \bigr) \\ \end{align}$$
If this is correct, what I need is to re-write the real and imaginary parts of the incomplete gamma function in a way that hopefully cancels out the $cos(\pi a)$ and $sin(\pi a)$. How do I do so from $\Re\left[\int_0^{(b-m)t+0i} \tau^{a-1} e^{-\tau} d\tau \right]$?