 # "Solution for differential equation describing linear input and exponential decay I try to model the concentration over time when there's an linear input and an exponential output (i.e. exponential decay) with known half-life. Input(t) = a+b*t, where t is the time (in years), a the input at year 0 and b the yearly growth to that input. Output(t) = lambda*N(t), where t is the time (in years), lambda the exponential decay constant and N(t) the concentration at year t. lambda is defined as lambda = ln(2)/th, where th is the half-life in years. Keenan Conway 2022-09-17 Answered
Solution for differential equation describing linear input and exponential decay
I try to model the concentration over time when there's an linear input and an exponential output (i.e. exponential decay) with known half-life.
Input(t) = a+b*t
where t is the time (in years), a the input at year 0 and b the yearly growth to that input.
Output(t) = lambda*N(t)
where t is the time (in years), lambda the exponential decay constant and N(t) the concentration at year t.
lambda is defined as
lambda = ln(2)/th
where th is the half-life in years.
The differential equation is therefore:
dN/dt = Input - Output = a+b*t-lambda*N(t)
Using wolframAlpha I get this solution:
N(t) = C*exp(-lambda*t) + (b/lambda)*t + (a/lambda) - (b/lambda^2)
where C is the initial concentration at t=0.
For small values of th this makes sense, but if th assumes higher values, the concentration is negative. How can this be?
As example:
a = 300
b = 20
th = 2
C = 300
For t = 10 I get a concentration of 1285.561.
But if I set th to 200, I get -1520536 at t = 10
You can still ask an expert for help

## Want to know more about Exponential growth and decay?

• Live experts 24/7
• Questions are typically answered in as fast as 30 minutes
• Personalized clear answers

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it Haylee Krause
You assumed that C was the initial amount ("concentration" is a term indicating the ratio of "active" amount to total amount, which is not something so easily controlled). But this is not the case. The initial amount is N(0), and that value is
$N\left(0\right)=C+\frac{a}{\lambda }-\frac{b}{{\lambda }^{2}}$
When a=300,b=20,C=300 and the half-life is 200 years, that value is about −1578233.5. The reason that after 10 years you have a negative amount is that you started with an even more negative amount and have not yet managed to overcome it.
If you want an initial amount N(0) to be 300, then you need to set $C=300-\frac{a}{\lambda }+\frac{b}{{\lambda }^{2}}\approx 1578833.5$
However, as I indicated in a comment, I am doubtful this equation is modelling what you think it is.
By your description, the repository starts out with an amount of 300. The first year, an additional 300 are added to it, for a total of 600, not including decay. The next year, an additional 320 are added, the year after 340 are added, then 360 the year after that, etc. Since you described it as "linear", I don't think this is what you are after.
Instead, I am guessing that a is supposed to be the initial amount, and each year an additional amount b is added. This gives the differential equation
$\frac{dN}{dt}=b-\lambda N$
whose solution is
$N\left(t\right)=\frac{b}{\lambda }+C{e}^{-\lambda t}$
Since $a=N\left(0\right)=b/\lambda +C$, we have $C=a-b/\lambda$. Therefore
$N\left(t\right)=\frac{b}{\lambda }+\left(a-\frac{b}{\lambda }\right){e}^{-\lambda t}$
Is the equation you are after.

We have step-by-step solutions for your answer!