$$\newcommand{\D}{\displaystyle} \renewcommand{\eqref}[1]{Eq.~(\ref{#1})}$$

# 2.1 Introduction

With an initial value problem for an ordinary differential equation (ODE) we mean a problem where all boundary conditions are given for one and the same value of the independent variable. For a first order ODE we get e.g. \begin{align} y'(x)&=f(x,y) \tag{2.1}\\ y(x_0)&=a \tag{2.2} \end{align} while for a second order ODE we get \begin{align} y''(x)&=f(x,y,y') \tag{2.3}\\ y(x_0)&=a,\ y'(x_0) = b \tag{2.4} \end{align} A first order ODE, as shown in Equation (2.2), will always be an initial value problem. For Equation (2.4), on the other hand, we can for instance specify the boundary conditions as follows, \begin{align} y(x_0)=a,\ y(x_1) = b \nonumber \end{align} With these boundary conditions Equation (2.4) presents a boundary value problem. In many applications boundary value problems are more common than initial value problems. But the solution technique for initial value problems may often be applied to solve boundary value problems.

Both from an analytical and numerical viewpoint initial value problems are easier to solve than boundary value problems, and methods for solution of initial value problems are more developed than for boundary value problems.

## 2.1.1 Example: A mathematical pendulum

Consider the problem of the mathematical pendulum (see Figure 1). By using Newton's second law in the $$\theta$$-direction one can show that the following equation must be satisfied: \begin{align} \frac{\partial^2 \theta}{\partial \tau^2} + \frac{g}{l}\sin (\theta) = 0 \tag{2.5}\\ \theta (0) = \theta_0 ,\ \frac{d\theta}{d\tau}(0) = 0 \tag{2.6} \end{align}

Figure 1: An illustration of the mathematical pendulum.

To present the governing equation (2.6) on a more convenient form, we introduce a dimensionless time $$t$$ given by $$t=\sqrt{\frac{g}{l}}\cdot\tau$$ such that (2.5) and (2.6) may be written as: \begin{align} \tag{2.7} \ddot{\theta}(t) + \sin (\theta (t)) = 0 \\ \theta (0) = \theta_0 ,\ \dot\theta (0) = 0 \tag{2.8} \end{align} The dot denotes derivation with respect to the dimensionless time $$t$$. For small displacements we can set $$\sin (\theta) \approx \theta$$, such that (2.7) and (2.8) becomes \begin{align} \tag{2.9} \ddot\theta (t)& + \theta (t) = 0 \\ \theta (0)& = \theta_0 ,\ \dot\theta (0) = 0 \tag{2.10} \end{align}

The difference between (2.7) and (2.9) is that the latter is linear, while the first is non-linear. The analytical solution of Equations (2.7) and (2.8) is given in Appendix G.2. in the Numeriske Beregninger.

## 2.1.2 n-th order linear ordinary differential equations

An n-th order linear ODE may be written on the generic form: $$$$a_n(x)y^{(n)}(x)+a_{n-1}(x)y^{(n-1)}(x)+\cdots+a_1(x)y'(x)+a_0(x)y(x)=b(x) \tag{2.11}$$$$

where $$y^{(k)}, k=0,1,\dots n$$ is referring to the $$k$$'th derivative and $$y^{(0)}(x)=y(x)$$.

If one or more of the coefficients $$a_k$$ also are functions of at least one $$y^{(k)},\ k = 0,1,\dots n$$, the ODE is non-linear. From (2.11) it follows that (2.7) is non-linear and (2.9) is linear.

Analytical solutions of non-linear ODEs are rare, and except from some special types, there are no general ways of finding such solutions. Therefore non-linear equations must usually be solved numerically. In many cases this is also the case for linear equations. For instance it doesn't exist a method to solve the general second order linear ODE given by $$\begin{equation*} a_2(x)\cdot y''(x)+a_1(x)\cdot y'(x) +a_0(x)\cdot y(x) =b(x)\nonumber \end{equation*}$$

From a numerical point of view the main difference between linear and non-linear equations is the multitude of solutions that may arise when solving non-linear equations. In a linear ODE it will be evident from the equation if there are special critical points where the solution changes character, while this is often not the case for non-linear equations.

For instance the equation $$y'(x)=y^2(x),\ y(0)=1$$ has the solution $$y(x)=\frac{1}{1-x}$$ such that $$y(x) \to \infty$$ for $$x \to 1$$, which isn't evident from the equation itself.