non homogeneous exponential distribution Given an exponential waiting time with rate $\lambda$ we know that the distribution for the waiting time would be 
$$ f(T=t) = \lambda e^{-\lambda t} $$
now, if we assume that the rate is not constant, let´s say $\lambda(t)$, I am wondering if the distribution would be just 
$$ f(T=t) = \lambda(t) e^{-\int_0^t \lambda(t) dt} $$
or not. And if not, what would be the distribution? I cannot find any references for this distribution, so any help is appreciated. 
 A: In actuarial science, the function $\lambda(t)$ - more commonly notated as $\mu_t$ - is known as the force of mortality or the hazard function. When the force of mortality is not constant, you obtain distributions that are not exponential. For life-insurance context, you may want to look up the Gompertz distribution and Makeham distribution.
Given a force of mortality $\mu_t$ for random variable $X$, the relationship between its CDF $F_X$, its PDF $f_X$, and $\mu_t$ is 
$$\mu_t=\dfrac{f_X(t)}{1-F_X(t)}=-\dfrac{S^{\prime}_X(t)}{S_X(t)}=-\dfrac{\text{d}}{\text{d}t}[\ln S_X(t)]$$
where $S_X = 1 - F_X$ is commonly called the "survival function." From this, you can integrate to obtain a formula for $S_X$. Given the property that $F_X(0)=0$ (do you see why?), we can obtain $S_X(0) = 1$, hence
$$\int_{0}^{t}\mu_s\text{ d}s=-\int_{0}^{t}\dfrac{\text{d}}{\text{d}t}[\ln S_X(t)]\text{ d}t=-[\ln S_X(t)-\ln 1]=-\ln S_X(t)$$
from which we obtain
$$S_X(t)=\exp\left[-\int_{0}^{t}\mu_s\text{ d}s \right]$$
and thus
$$F_X(t)=1-\exp\left[-\int_{0}^{t}\mu_s\text{ d}s \right]$$
and you can differentiate to obtain
$$f_X(t)=\mu_t\exp\left[-\int_{0}^{t}\mu_s\text{ d}s \right]$$
matching your form above.
A: Except for your error about the meaning of a density, you are correct.
The easy way to figure this out is to consider the discrete version. Suppose the probability of an event happening in $[t,t+dt]$ is $\lambda(t) dt$. Then the probability of waiting for at least n intervals with no event is 
$$P=\prod_{i=1}^n (1-dt \lambda((i-1)dt).$$
Now set $dt=t/n$ and send $n \to \infty$. To compute the limit, compute the exponential of its logarithm. The logarithm is 
$$\log(P)=\sum_{i=1}^n \log \left ( 1-\frac{t}{n} \lambda \left ( (i-1)\frac{t}{n} \right ) \right ).$$
By linear approximation
$$\log(P)=o(1)+\sum_{i=1}^n -\frac{t}{n} \lambda \left ( (i-1) \frac{t}{n} \right ).$$ 
The sum is a Riemann sum, and the higher order correction vanishes in the $n \to \infty$ limit, so you get the limit of $\log(P)$ as an integral. The quantity you just calculated is then $P(T>t)$.
By the way, the main place you would find this is in references to continuous time, discrete space, time-inhomogeneous Markov chains, where it appears as the holding time distribution.
A: To sample a value from a non-homogeneous exponential distribution you can follow this steps
S1. Sample $x$ from homogeneous exponential with rate 1
S2. Calculate $\Lambda^{-1} (x)$
where $\Lambda(t)$ is the intensity function (the integral of the rate).
The random variable $\Lambda^{-1} (x)$ has a non-homogeneous distribution with rate $\lambda(t)$.
A reference could be the paper "Generating Nonhomogeneous Poisson Processes" by Raghu Pasupathy.
