Polska wersja

Numerical Differential Equations


winter semester 2019-20

Time: Monday lecture 1415-1545 room 1780 and classes/lab 1605-1735 room 1780 or computer lab 2043 (MIMUW bdg., Banacha 2 - entrance - Pasteura Street)

Evaluation

an oral exam. Three questions from the list of approx. 10-12. One is chosen by me the other by the student. Or alternatively one can prepare a project. List of projects in pdf file (originally the orojects were in Polish and they were automatically translated, thus English may be poor -if something is unclear or one has any questions or comments please ask).

Exam questions

I will ask three questions from the list below - the 1st two ones may be selected by a student, the last one by myself.
I will add new questions as the course progresses...
  1. One step schemes. Examples and convergence theory.
  2. Multistep schemes . Examples including Adams schemes. Convergence theory.
  3. Stiffness. Definition. Examples of ODEs. Idea of adaptive step control.
  4. Finite difference method for elliptic equation in 1D. 1D Example: - u''+u=f u(a)=u(b)=0 and detailed convergence analysis of this problem in a discrete maximum norm
  5. Finite difference method for elliptic equations. 2D Example: -Laplacian u=f , u=0 on boundary. Abstract convergence analysis: the order of local truncation error and stability. Discrete convergence - definition and Lax-Filipov theorem.
  6. Idea of Finite Element Method. Analysis of convergence of linear finite element in 1D for -u''=f, u(a)=u(b)=0.
  7. Elements of abstract FEM theory: Lax Milgram theorem. Cea Lemma. Application to 2d elliptic boundary problem with homogeneous Dirichlet boundary element.
  8. Elements of abstract FEM theory: continuous FEM spaces, affine families of FEM spaces, shape regularity etc
  9. FEM and different boundary conditions for 2nd order elliptic boundary problem: non-zero Dirichlet, Neumann, Robin, mixed. (optional; it is not discussed in Lect Notes. I hope it will be discussed during a lecture but I will not ask this question unless somebody choose it)
  10. Schemes for parabolic differential equations: FDM and FEM in 1D or 2D - an idea, some properties - no proofs (optional - as in the lecture notes)
  11. Basic explicit finite difference schemes for hyperbolic PDEs. Stability and consistency. (optional - if somebody really like the subject)
  12. Pure Neumann boundary conditions for -Laplacian u=f. How to solve it using FEM? How to solve the singular linear problem arising there?
    optional - means that this question may be asked only with the student consent

Link to current lab

Syllabus

Numerical methods for
  1. ordinary differential equations (ODEs)
  2. elliptic partial differential equations (PDEs)
  3. evolutionary PDEs (parabolic and hyperbolic of first order)
the following classes of methods are going to be discussed
  1. one-step and linear multi-step schemes for initial ODEs problems
  2. finite difference method
  3. finite element method
There are some computer labs (instead of standard "blackboard" classes)

The course is elementary - it is required to know the basics of liner algebra, mathematical analysis and theory of ODEs.

It is not necessary to have any knowledge from PDEs theory all necessary facts will be given during our course

There are lecture notes for this course in Polish.

Lecture notes

(In Polish) Leszek Marcinkowski, Numeryczne równania różniczkowe, 2010.
Published on-line: WWW page (there is a link to pdf file with the lecture notes).
Pdf file with the newest version of the notes.
Please, send me an e-mail with comments if you find any errors, typos etc,

References

Text books

  1. Deuflhard, Peter, Bornemann, Folkmar, Scientific Computing with Ordinary Differential Equations, Series: Texts in Applied Mathematics, Vol. 42, Springer-Verlag, New York, 2002. (theory of ODEs, ODE schemes, Boundary Value Problems in 1D) One can download a pdf file from MIMUW computers (valid Dec 2014): Springer link
  2. David F. Griffiths, Desmond J. Higham, Numerical Methods for Ordinary Differential Equations, Springer-Verlag, 1st Edition, London, 2010. An elementary textbook on ODE schemes. One can download a pdf file from MIMUW computers (valid Dec 2014): Springer link
  3. Claes Johnson, Numerical solution of partial differential equations by the finite element method, Cambridge University Press, Cambridge, 1987.
  4. Randall J. LeVeque, Finite difference methods for ordinary and partial differential equations, Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 2007, Steady-state and time-dependent problems. (numerical schemes for ODES, finite difference methods for elliptic and parabolic PDEs)
  5. Alfio Quarteroni, Riccardo Sacco, and Fausto Saleri, Numerical mathematics, Texts in Applied Mathematics, vol. 37, Springer-Verlag, New York, 2000. (numerical schemes for ODEs and some PDES - hyperbolic nad parabolic) One can download a pdf file from MIMUW computers (valid Dec 2014): Springer Link
  6. John C. Strikwerda, Finite difference schemes and partial differential equations, second ed., Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 2004. (FD schemes for PDEs - all types)

Monographs or advanced text books

  1. Dietrich Braess, Finite elements, third ed., Cambridge University Press, Cambridge, 2007, Theory, fast solvers, and applications in elasticity theory, Translated from the German by Larry L. Schumaker. (advanced text book)
  2. Susanne C. Brenner and L. Ridgway Scott, The mathematical theory of finite element methods, third ed., Texts in Applied Mathematics, vol. 15, Springer, New York, 2008.
  3. J. C. Butcher, Numerical methods for ordinary differential equations, second ed., John Wiley and Sons Ltd., Chichester, 2008.
  4. P. G. Ciarlet and J.-L. Lions (eds.), Handbook of numerical analysis. Vol. II, Handbook of Numerical Analysis, II, North-Holland, Amsterdam, 1991, Finite element methods. Part 1.
  5. Philippe G. Ciarlet, The finite element method for elliptic problems, Classics in Applied Mathematics, vol. 40, Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 2002, Reprint of the 1978 original [North-Holland, Amsterdam].
  6. E. Hairer, S. P. Norsett, and G. Wanner, Solving ordinary differential equations. I, second ed., Springer Series in Computational Mathematics, vol. 8, Springer-Verlag, Berlin, 1993, Nonstiff problems.
  7. E. Hairer and G. Wanner, Solving ordinary differential equations. II, second ed., Springer Series in Computational Mathematics, vol. 14, Springer-Verlag, Berlin, 1996, Stiff and differential-algebraic problems.
  8. Bosko S. Jovanovich, Endre Suelli, Analysis of Finite Difference Schemes For Linear Partial Differential Equations with Generalized Solutions, Springer Series in Computationam Mathematics, volume 46, Springer , 2014. Springer link (not available on MIMUW servers)
  9. Alfio Quarteroni and Alberto Valli, Numerical approximation of partial differential equations, Springer Series in Computational Mathematics, vol. 23, Springer-Verlag, Berlin, 1994. (FD schemes and FE for PDEs) One can download a pdf file from MIMUW computers (valid Dec 2014):
  10. Springer Link
  11. J. W. Thomas, Numerical Partial Differential Equations, Finite Difference Methods, Texts in Applied Mathmematics, volume 22, Springer, 1995. Springer link (valid Nov 2016)

LAB

link to Octave (one can download linux or windows version of octave)
octave-forge - octave extension

octave manual in html
  • Lab 1 (1st two weeks of classes) Introduction to octave. Euler's schemes
    m-file with explicit Euler scheme and a script with some tests:
    testodelin19.m - a script with some tests of the explicit Euler scheme for dx/dt=ax x(t0)=x0 (Oct 7, 2019)
  • Lab 2 - continuation... Function lsode() in octave and simple ODE schemes cont. In multistep ODE schemes take x_1,x_2 etc as exact solutions if not take x_k k=1,..,p- p-1 computed by using some explicite 1-step method of the same order e.g. Taylor scheme for midpoint one.
    exEuler19.m - implementation of expicit Euler scheme
    midpoint19.m - implementation of midpoint scheme
    testexEuler19.m - test of explicit (forward) Euler in 1D and 2D
    taylor19.m - implementation of the forward 2nd order Taylor scheme
  • Lab 3 Experimental testing the order of ODE schemes cont. Testing starting for multistep schemes (for 2-step Adams-Bashforth).
    AdamsBashford19.m - explicit Adams-Bashforth scheme (of order 2)
    Heun19.m - explicit Heun scheme (a Runge-Kutta scheme of order 2)
    testconord19.m - tests of convergence order of the following schemes: explicit Euler (order 1), Adams-Bashforth 2 step, midpoint, Taylor of 2nd order, Heun schemes (of order 2)
    teststart19.m - tests of convergence order of Adams-Bashforth scheme for different starting values of x1 \approx x(t0+h) -a/exact value i.e. x1=solution at t0+h b/ x1 computed by one step of forward Euler of order one c/x1 computed by one step of forward Heun scheme (of order 2)
  • Lab 4. Stiffness. Shooting method for -u''+bu'+ cu=f with Dirichlet bnd cond : u(a)=alpha u(b)=beta and for mixed bnf conditions: u'(a)=alpha u(b)=beta
    EulerLTE19.m - tests of order of LTE for Euler methods
    HeunLTE19.m - tests of order of LTE for Heun method
    trapzPC.m - predictor-corrector with Heun as the predictor and the trapezoid as the corrector
    testtrapzPC.m - tests of predictor-corrector with Heun as the predictor and the trapezoid as the corrector
  • Lab 5. Shooting method and finite difference method (FDM) for

    -u''+d(x)u' c(x)u=f with Dirichlet bnd cond : u(a)=alpha u(b)=beta and for mixed bnf conditions: u'(a)=alpha u(b)=beta


    linshoot.m a function solving by a shooting method a linear 2nd order BVP:

    -y''+d(x)y'+c(x)y=f(x) y(a)=al y(b)=be


    testshoot19.m some test of -shooting method for nonlinear

    y''=F(x,y,y') y(a)=al y(b)=be


    shooting.m -a function solving by a shooting method a nonlinear BVP:

    y''=F(x,y,y') y(a)=al y(b)=be

  • Lab 6. FDM for Poisson equation in 1D
    FDMDsolver.m -m-file with the simplest FDM method (solver) for linear boundary value ODE problem: -y''+cy=f; y(a)=al y(b)=be
    fdm1d19.m -script solving -u''+u=0 u(0)=u(b)=1 by FDM and shoooting method - and comparing the results- FDM works well for any b (reasonable), shootong stops working for b larger around 12-14
    fdmLTE19.m -script testing the order of LTE of FDM in max discrete norm for -u''=sin(x) u(0)=u(pi)=0 - the solution is sin(x) (please do the same in the discrete L2 norm ||uh||_{0,h}^2=h\sum_x uh(x)^2
    testFDMConvOrd19.m -m-file with tests of FDM schemes for boundary value ODE problems: -y''+cy=f; y(a)=al y(b)=be or y'(b)=be - convergence order tests for standard mesh or mesh not containing the right end for Dirichlet bnd cond (with or without Collatz approximation), mixed bnd i.e. Dirichlet bnd cond at a and Neumann at b - the Neumann cond approxiamted by: backward difference (order 1); central difference (requirest an extra ghost point - order 2); modified backward difference using the ODE equation at b (order 2)
  • Lab 7 FDM method in 2D
    testFDM2d.m -script testing the order of convergence of FDM in max and L2 discrete norms for

    - Laplacian u=2pi^2*sin(x)sin(y)
    u=0 on boundary

    - the solution is sin(pi*x)sin(pi*y)
  • Lab 8 - FEM in 1d Finite element method (FDM) for -u'' +cu=f on [a,b] with Dirichlet bnd condition. In almost all problems we use linear continuous finite element method i.e conforming P_1 FEM on any mesh (x_0,...,x_N) with x_0=a and x_n=b. Weak form: find u\in V_h s.t.

    \int_a^b u'v' + c*u*v dx =\int_a^b f v dx \forall v \in V_h

    - in nodal basis we get the system (A+cB)u=F with A, B (or their submatrices...) obtained from the script below, the rhs for linear FEM we can approximate by composite trapezoidal rule i.e. F=(f_i)_i with f_i=\int_a^b f\phi_i dx \approx 0.5*f(x_i)(x_{i-1}-x_{i+1}) i=1,...,N-1 (note that in case of equidistant mesh x_k=a+k*h we get f_i=h*f(x_i) as in FDM method...). The H^1 seminorm and L^2 norm may be computed for u\inV_h as |u|_1^2=u^TAu and ||u||_0^2=u^TMu - u vector of coefficients in nodal basis.
    We computed during classes the stiffness and mass matrices for FEM on the following mesh: a=x_0 A=( \int_a^b phi_k' phi_l' dx) and M=( \int_a^b phi_k phi_l dx), namely:
    \int_a^b \phi_k\phi_l dx= 0 |k-l|>1;
    (1/3)*(|x_k-x_{k+1}|+|x_k-x_{k-1}|) k=l ;
    (1/6)*|x_k-x_l| |k-l|=1;
    assuming x_{-1}=x_0,x_{N+1}=x_N.
    \int_a^b phi_k'phi_l'dx= 0 |k-l|>1;
    (|x_k-x_{k+1}|^{-1}+|x_k-x_{k-1}|^{-1}) k=l;
    -|x_k-x_l|^{-1} |k-l|=1
    taking |x_0-x_{-1}|^{-1}=|x_N-x_{N+1}|^{-1}=0. Note that on the equidistant mesh and zero bnd (then k,l=1,...,N-1) A=(1/h)*tridiagonal matrix with 2 on the main diagonal and minus one on the subdiagonal and superdiagonal and B=(h^2)*tridiagona matrix with 2/3 on the main diagonal and 1/6 on the remaining super and sub diagonals.
    FEM1Dmats.m - - function creates linear 1D linear FEM matrices for

    -au''+cu=f

    i.e.

    A=(\int_a^b \phi_k'\phi_l')_{k,l=0}^N and B=(\int_a^b \phi_k\phi_l)_{k,l=0}^N

    for \phi_k nodal basis - piecewise linear - any grid - to get matrix for zero Dirichlet bnd - take submatrices of A and B The returned matrices are for the nodal basis (\phi_i)_{i=0}^N i.e. includes the basis functions related to bnd poits, in case of Dirichlet bnd we have to take submatrices obtained by removing first and last rows/cols.
    FEM1Dsolver.m - - function solves using linear FEM on the given mesh the problem:

    -au''+cu=f in (a,b)
    u(a)=al, u(b)=be

    The returned vector - solution contains the approximated values at the m mesh points - the coefficients in the nodal basis (including boundary points).
    testFEM1d.m - some simple tests of FDM and FEM for -u''+cu=g in (a,b) u(a)=u(b)=0 (as wrotten during the lab)
  • Lab FD method for parabolic equations in 1D i.e. we discretized equation u_t-u_{xx}=f u(t,a)=ga(t) u(t,b)=gb(t) u(0,x)=u0(x) by FDM with respect to x - and apply octave ODE solver (lsode()) to the resulting ODEs system
    FDMDParabsol.m - - function solves using linear FDM on the standard uniform equidistant mesh the problem:

    d/dt u -au''+cu=f in (a,b)
    u(t,a)=al(t), u(t,b)=be(t) boundary conditions u(0,x)=u0(x) an initial value

    The returned matrix - solution contains in rows the approximated values at interior points at the discrete times i.e. each row is the FDM approximation (on equidistant mesh of (a,b)) of the solution of the respective discrete time

    Octave scripts with solution of some problems from our labs

    nrrbasic.m - a simple octave script with basic operations like matrices multiplications etc

    ODE schemes - simple implementations and tests

    exEuler19.m - implementation of expicit Euler scheme
    midpoint19.m - implementation of midpoint scheme
    testexEuler19.m - test of explicit (forward) Euler in 1D and 2D
    taylor19.m - implementation of the forward 2nd order Taylor scheme
    AdamsBashford19.m - explicit Adams-Bashforth scheme (of order 2)
    Heun19.m - explicit Heun scheme (a Runge-Kutta scheme of order 2)
    testconord19.m - tests of convergence order of the following schemes: explicit Euler (order 1), Adams-Bashforth 2 step, midpoint, Taylor of 2nd order, Heun schemes (of order 2)
    teststart19.m - tests of convergence order of Adams-Bashforth scheme for different starting values of x1 \approx x(t0+h) -a/exact value i.e. x1=solution at t0+h b/ x1 computed by one step of forward Euler of order one c/x1 computed by one step of forward Heun scheme (of order 2)
    EulerLTE19.m - tests of order of LTE for Euler methods
    HeunLTE19.m - tests of order of LTE for Heun method
    trapzPC.m - predictor-corrector with Heun as the predictor and the trapezoid as the corrector
    testtrapzPC.m - tests of predictor-corrector with Heun as the predictor and the trapezoid as the corrector
    linshoot.m a function solving by a shooting method a linear 2nd order BVP:

    -y''+d(x)y'+c(x)y=f(x) y(a)=al y(b)=be


    testshoot19.m some test of -shooting method for nonlinear

    y''=F(x,y,y') y(a)=al y(b)=be


    shooting.m -a function solving by a shooting method a nonlinear BVP:

    y''=F(x,y,y') y(a)=al y(b)=be

    FDM schemes - simple implementations and tests


    FDMDsolver.m -m-file with the simplest FDM method (solver) for linear boundary value ODE problem: -y''+cy=f; y(a)=al y(b)=be
    fdm1d19.m -script solving -u''+u=0 u(0)=u(b)=1 by FDM and shoooting method - and comparing the results- FDM works well for any b (reasonable), shootong stops working for b larger around 12-14
    fdmLTE19.m -script testing the order of LTE of FDM in max discrete norm for -u''=sin(x) u(0)=u(pi)=0 - the solution is sin(x) (please do the same in the discrete L2 norm ||uh||_{0,h}^2=h\sum_x uh(x)^2
    testFDMConvOrd19.m -m-file with tests of FDM schemes for boundary value ODE problems: -y''+cy=f; y(a)=al y(b)=be or y'(b)=be - convergence order tests for standard mesh or mesh not containing the right end for Dirichlet bnd cond (with or without Collatz approximation), mixed bnd i.e. Dirichlet bnd cond at a and Neumann at b - the Neumann cond approxiamted by: backward difference (order 1); central difference (requirest an extra ghost point - order 2); modified backward difference using the ODE equation at b (order 2)
    testFDM2d.m -script testing the order of convergence of FDM in max and L2 discrete norms for

    - Laplacian u=2pi^2*sin(x)sin(y)
    u=0 on boundary

    - the solution is sin(pi*x)sin(pi*y)

    FDM schemes - simple implementations and tests


    FEM1Dmats.m - - function creates linear 1D linear FEM matrices for

    -au''+cu=f

    i.e.

    A=(\int_a^b \phi_k'\phi_l')_{k,l=0}^N and B=(\int_a^b \phi_k\phi_l)_{k,l=0}^N

    for \phi_k nodal basis - piecewise linear - any grid - to get matrix for zero Dirichlet bnd - take submatrices of A and B The returned matrices are for the nodal basis (\phi_i)_{i=0}^N i.e. includes the basis functions related to bnd poits, in case of Dirichlet bnd we have to take submatrices obtained by removing first and last rows/cols.

    Solvers for paraboli problems


    FDMDParabsol.m - - function solves using linear FDM on the standard uniform equidistant mesh the problem:

    d/dt u -au''+cu=f in (a,b)
    u(a)=al, u(b)=be (al be constant but can be easily changed to al(t) be(t)) u(0,x)=u0(x)

    The returned matrix - solution contains in rows the approximated values at interior points at the discrete times i.e. each row is the FDM approximation (on equidistant mesh of (a,b)) of the solution of the respective discrete time
    My home page
    Last update: February 7th, 2020.