# A simple first order ODE¶

The simplest example of a first order ODE is

with the solution

where \(y\left( 0 \right)\) or \(y_{0}\), the value of
\(y\left( t \right)\) at \(t = 0\), is the *initial condition*.
The final steady state solution as \(t \rightarrow \infty\) is
\(y\left( \left. \ t \right|_{\infty} \right) = y_{\infty} = \frac{b}{a}\)
(see Figure 6). Note that \(t = \tau = \frac{1}{a}\) is called the
*time constant* of the exponential decay, and that

At \(t = \tau\) , \(y\left( t \right)\) has therefore fallen to \(\frac{1}{e}\) (or about 37%) of the difference between the initial (\(y\left( 0 \right)\)) and final steady state ( \(y\left( \infty \right)\)) values[1].

Choosing parameters \(a = \tau = 1;b = 2\) and
\(y\left( 0 \right) = 5\), the *CellML Text* for this model is

```
def model first_order_model as
def comp main as
var t: dimensionless {init: 0};
var y: dimensionless {init: 5};
var a: dimensionless {init: 1};
var b: dimensionless {init: 2};
ode(y,t)=-a*y+b;
enddef;
enddef;
```

The solution by OpenCOR is shown in Fig. 5(a) for these parameters (a
decaying exponential) and in Fig. 5(b) for parameters
\(a = 1;b = 5\) and \(y\left( 0 \right) = 2\) (an inverted
decaying exponential). Note the simulation panel with *Ending
point*=10, *Point interval*=0.1. Try putting \(a = - 1\).

These two solutions have the same exponential time constant (\(\tau = \frac{1}{a} = 1\)) but different initial and final (steady state) values.

The exponential decay curve shown on the left in Fig. 5 is a common
feature of many models and in the case of radioactive decay (for
example) is a statement that the **rate of decay**
(\(- \frac{\text{dy}}{\text{dt}}\)) is proportional to the
**current amount of substance** (\(y\)). This is illustrated on
the NZ$100 note (should you be lucky enough to possess one), shown in
Figure 8.

Footnotes

[1] | It is often convenient to write a first order equation as \(\tau\frac{\text{dy}}{\text{dt}} = - y + y_{\infty}\), so that its solution is expressed in terms of time constant \(\tau\), initial condition \(y_{0}\) and steady state solution \(y_{\infty}\) as: \(y\left( t \right) = y_{\infty} + \left( y_{0} - y_{\infty} \right).e^{- \frac{t}{\tau}}\). |