01 Exercises Ordinary Differential Equations (ODEs)
01 Exercises Ordinary Differential Equations (ODEs)
© Datasim Education BV
*1. Equation (1) is a simple example of a singular perturbation problem, characterized by a small
parameter of the highest (in this case, first order) derivative. There are many situations in fluid
mechanics and computational finance where such equations are used, in particular convection-
diffusion-reaction PDEs and their numerical solution:
a) FDM 2006, sections 11.2.2
b) C++ 2004, sections 11.6, 18.3
c) C++ 2018, sections 20.7.1, 20.7.2
e) Adjoint form: FDM 2006 section 1.5, C++ 2004 section 17.5, C++ 2018, section 20.3.2, 20.3.4
1(b) is a stiff problem because derivatives blow up at x = 0 for small values of \epsilon.
1(c) Find the functions b(x), c(x).
1(f) transforming to a finite interval has many advantages, see C++ 2018 section 20.3.4. An
interesting exercise is to apply Picard to the transformed ODE to show existence on 0 < y < 1.
1(g) Classical constant-mesh FD schemes behave badly for singular perturbation problems. In these
cases we use Duffy exponential fitting or adaptive scheme (e.g. Bulirsch-Stoer), for example.
Numerical approximation of ODEs; C++ 2018 chapter 24,25; C++ 2004 chapter 11..
The results for first-order ODEs are very useful and will be generalised to 2nd-order ODEs and
PDEs.
In many cases, you may be able to find an explicit (which is not the same as closed form)
representation for the solution.
*2. Just standard examples of using the integrating factor method. You can check your solution by
plugging it into the ODE. It tests your ability to solve a problem, step-by-step.
1
Some integrals have integrands that are difficult analytically. Just leave as is.
For the ODE dx=dt = x=t you can solve by 1) Picard, 2) integrating factor or 3) separation of
variables as in
dx=x = dt=t => logx = logt + C etc.
*3. Some problems (e.g. interest rate, backwards induction binomial methods) are written in this
way. However, in this course we always write ODEs and PDEs an initial value problems.
*4. Continuous and discrete Gronwall is fundamental when analysing existence and uniqueness of
solution of ODEs and PDEs as well as finite difference method.
*5. Picard iteration is discussed C++ 2018 section 24.5. It is used for ODEs to prove that they have a
unique solution in a given interval. Execution of the process results in a series solution whose
convergence (or lack of) can be proved using series tests (root, ratio tests). In general, numerical
approximation of ODEs based on the Picard iterates is probably not optimal.
*9. Activation functions are extremely important in Machine Learning (ML). Here we see that they
satisfy an ODE that has an analytical solution (we got lucky) and that be approximated by a range of
schemes in C++ and Python (see my code).
*10. The Cauchy-Euler ODE has the same form as the time-independent part of the Black-Scholes
PDE. For this reason alone it is worth investigating. A common theme is transforming the ODE in
some way:
a) Creating a constant-coefficient version
b) Mapping an ODE on a semi-infinite interval to the unit interval
c) Transforming the ODE to adjoint form
d) Converting a 2nd-order ODE to a system of 1st-order ODEs
e) Semi-discretisation of a PDE in space to produce a system of ODEs in time
1. (Simple ODE)
Consider the following scalar linear initial value problem (IVP):
8 du
< " dx + au = 0; a > 0 constant; 0<x<1
(1)
:
u(0) = A
2
d) Use the Picard iteration method to find a series solution to (1) in the case A = 1. Does the
evolving series look familiar and does it converge?
e) We consider (1) in the case a = a(x) is a positive function. Convert (1) to adjoint form (find the
unknown functions and ). Use this formulation to find the solution of (1). The adjoint
form is defined as:
8 d
< b(x) dx (c(x)u) = 0; 0<x<1
(2)
:
u(0) = A:
un+1 ¡ un
" + aun = 0; n ¸ 0; u0 = A (3)
h
½ ¾
c(tn+1 )un+1 ¡ c(tn)un
b(tn) = 0; n ¸ 0; u0 = A: (4)
h
Implement these schemes in C++ or Python and investigate the stability and accuracy of
these schemes for various values of " and h .
2. (Integrating Factor)
Consider the ODE (where ). We use the integrating factor:
to solve it.
3
Use this method to find the solutions of the following ODEs and IVPs:
For the last ODE in this list, find the solution using Picard iteration.
is given by:
(hint: use change of variables and use the integrating factor method).
4. (Grönwall’s Inequality)
Prove Grönwall’s Inequality:
If then .
4
then
(5)
(6)
6. (Jacobian Matrix)
Compute the Jacobian for the following autonomous systems:
5
to autonomous form:
Make the system explicit by identifying the function . What are the initial conditions?
9. (Activation Function)
Consider the activation function:
Determine the values of for which this problem has a unique solution by constructing the Picard
iterates. Approximate the ODE by finite difference schemes.
6
Define the variable substitution:
Prove that:
Solve this ODE using its characteristic polynomial in the case of distinct roots:
where and are roots of the characteristic polonomial and and are
constants.
Show that: