# Analyzing solutions of y'= r-ky using W lambert function?

## Main Question or Discussion Point

consider this IVP
y'=r-ky , y(0)=y0
y= (y0)e^(-kt) + (r/k)(1-e^(-kt))
if y,y0,r,t are provided, we should be able to solve for k and that's the problem but what I'm really interested is analyzing this problem

if we let y=0.99 (r/k) find t in terms of all other variables

Of courses, if y0 = 0 we can see that t= -(ln 0.01)/k

i wonder if y0 is not zero is it possible to analyze variable t using any knowledge or technology from mathematics?

this problems is derived from real application of pharmacokinetics IV infusion where

y= amount of drug at time t
y0 = initial amount of drug at t = 0
r = infusion rate
k = elimination rate constant
(r/k) = amount of drug at steady-state (as t --> infinity the amount of drug will approach this value and 99% of (r/k) is a good approximation of amount of drug at steady-state)

so what I really ask is how the initial amount of drug reflects the time to reach steady-state ( for example. how much we increase y0 in order to halve the time to reach steady-state )

I'm sorry you are not generating any responses at the moment. Is there any additional information you can share with us? Any new findings?

Let's see what I can whip up...
$y' + ky = r$ is a first-order, linear, non-homogenous ODE with $k \neq 0$ and $r \neq 0$, both of which I assume to be constant.
The general solution is (by partitioning into homogenous and particular solutions) $C_0 e^{-kt} + \frac{r}{k}$. Given an initial value, $y(0) = y_0$, the unique solution is $(y_0 - \frac{r}{k})e^{-kt} + \frac{r}{k}$. (Same as yours, but rewritten.)

You then ask what I assume to be is the time at which this solution is equal to $0.99\frac{r}{k}$.

$$(y_0 - \frac{r}{k})e^{-kt} + \frac{r}{k} = 0.99\frac{r}{k}$$
$$(y_0 - \frac{r}{k})e^{-kt} + 0.01\frac{r}{k} = 0$$
$$(y_0 - \frac{r}{k})e^{-kt} = -0.01\frac{r}{k}$$
$$e^{-kt} = -0.01\frac{\frac{r}{k}}{y_0 - \frac{r}{k}}$$
$$e^{-kt} = -0.01\frac{r}{k y_0 - r}$$
Immediately, we see that $\frac{r}{k y_0 - r} < 0$ for there to be a real-valued, finite solution.

It's worth noting that if $k = 0$, we get a linear polynomial as a solution to the ODE, for which there is no steady state unless $r = 0$ as well, in which case it's $y_0$ as the solution is just a constant. If $k \neq 0$ and $r = 0$, the only steady state would be 0, for which your approximation fails to give a finite solution to the problem. If $k y_0 - r = 0$, the solution to the ODE would be $\frac{r}{k}$, which has a steady-state but the approximation fails as well.

In any case, assuming $\frac{r}{k y_0 - r} < 0$, the solution is:
$$e^{-kt} = -0.01\frac{r}{k y_0 - r}$$
$$-kt = \ln{\left(-0.01\frac{r}{k y_0 - r}\right)}$$
$$t = -\frac{\ln{\left(-0.01\frac{r}{k y_0 - r}\right)}}{k} = -\frac{\ln{\left(0.01\frac{r}{r - k y_0}\right)}}{k}$$