# I Exponential decay: I need an expression for N at time t

1. Apr 25, 2017

### Jehannum

I have a large quantity N, which starts off equal to a determinable value N0.

Over a short time ∆t, the value of N changes by -∆t*(B*N - C)

where B and C are determinable constants. Am I correct in thinking I can turn this into:

dN/dt = -(B*N - C)

How do I get this into a formula for N at time t? The 'extra' constant C seems to be making it more difficult than the examples of exponential decay I've found on the net.

2. Apr 25, 2017

### Staff: Mentor

There are various ways to solve the differential equation, but the easiest is to "guess" the answer: an exponential function plus a constant. You can then find the parameters of this ansatz.

3. Apr 27, 2017

### eys_physics

You can solve the equation in two steps:
1) Solve the homogeneous equation: $dN_h/dt=-B*N_h(t)$
2) Then, you need to find a particular solution satisfying the full equation. In this case we can guess $N_p(t)=A$, where $A$ is to be determined.
3) The most general solution is $N(t)=N_h(t)+N_p(t)$

4. Apr 27, 2017

### Jehannum

Unfortunately, my maths isn't yet advanced enough to do that.

I've been using a computer program to iterate the value of N over shorter and shorter dt intervals:

Num0 = 8.98249E+23 'Num0 = start value of N
B = 1.3831E-3
C = 1.21989E+21​

Numleft = Num0 'Numleft is the value of N as it decreases through the iterations

For time = 0 To (120 / dt) Step dt
Numleft = Numleft - dt * (B * Numleft - C)
Next time

As I try smaller and smaller values of dt, the final value of Numleft converges to 8.82E23

B and C will change in different situations. I'd like a non-iterative equation to find Numleft for any B and C (these will always be positive, if that helps).

PS. I notice that the constant C is not multiplied by Numleft, so the calculation in the loop could be written as: Numleft = Numleft - dt * B * Numleft + dt * C

Does this mean that dt * C can be ignored as dt -> 0?​

5. Apr 27, 2017

### Staff: Mentor

That is more complicated than finding the exact solution.

6. Apr 27, 2017

### eys_physics

I don't know what your background in Mathematics is. How to solve that differential equation is taught in a first course in differential equations, already in high school. Anyway, I can give some advice regarding how to solve it numerically. I don't know if you can find a non-iterative equation unless you solve it analytically.
However, I think you have misunderstood the way it should be solved. To do this numerically the simplest way is to discretize the equation. That is,
$dN \rightarrow N_{k+1}-N_{k)}, dt\rightarrow\Delta_t=t_{k+1}-t_{k}$, where $N_{k+1}=N(t_{k+1}), N_{k}=N(t_{k})$. Here, $t_k=k*\Delta$, assuming a equidistant mesh in time.
Then, you have
$N_{k+1}=N_{k}-(BN_k-C)$, where $N_0=Num0$
In this way you can compute $N(t)$ by starting from $t=0$ and use the aforementioned relation. This is the so-called Euler method, see e.g. https://en.wikipedia.org/wiki/Euler_method

7. Apr 27, 2017

### eys_physics

Yes, I completely agree with you.