Polska wersja

Numerical Differential Equations


winter semester 2018-19

Time: Tuesday lecture 1415-1545 room 1780 and classes/lab 1605-1735 room 1780 or computer lab 3044 (MIMUW bdg., Banacha 2 - entrance - Pasteura Street)
The dates of the oral exam (II term) by an appointment (made preferable by e-mail); I may be tentatively on Thu Feb 21st, 2019 after 10am in my room 5010. Check this page on Wed Feb 20th, 2019 in the evening.

Exam questions

    I will ask 2 questions from the list below - the 1st one may be selected by You, the second by myself.
  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 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 discussed it 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 (as in the lecture notes or as was presented in the lecture)
  11. Basic explicit finite difference schemes for hyperbolic PDEs. Stability and consistency. (if I manage to present it in the last lecture)
  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)
    optional - means that this question may be asked only with the student consent

Link to current lab
Evaluation: an oral exam. Two questions from the list of approx. 10-12. One is chosen by me the other by the student.

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:
    testodelin18.m - a script with some tests of the explicit Euler scheme for dx/dt=ax x(t0)=x0 (as written on the board Oct 2, 2018)
  • 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.
    exEuler18.m - implementation of expicit Euler scheme
    testexEuler18.m - test of explicit Euler in 1 and 2D
    midpoint18.m - implementation of midpoint scheme
    taylor18.m - implementation of Taylor scheme
  • Lab 3 Experimental testing the order of ODE schemes cont. Testing starting for multistep schemes (for 2-step Adams-Bashforth).
    testmidpoint18.m - test of midpoint in 1D
    AdamsB218.m - explicit Adams-Bashforth scheme (of order 2)
    testAdamsB218.m - tests of explicit Adams-Bashforth scheme (of order 2)
    Heun18.m - explicit Heun scheme (a Runge-Kutta 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
    predcorr18.m - 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
    testshoot18.m -shooting method for linear boundary value ODE problem: -y''+y=0; y(0)=1 y(b)=1 (b=1 - shooting works fine, b=20 - shooting does not work at all - why?)
    testfdmsex18.m -the simplest FDM method for linear boundary value ODE problem: -y''+y=0; y(0)=1 y(b)=1 works well for b=1 and 20 (or even larger b)
    linshoot18.m -m-file with a function linshoot18() solving the linear boundary value ODE problem: -y''+p(x)y+q(x)y=f(x); y(a)=alpha y(b)=beta
  • Lab 6 and 7. FDM for Poisson equation in 1D cont and in 2D
    testlap1d18.m -tests of the simplest FDM method for linear boundary value ODE problem: -y''=sin(x); y(0)=0 y(1)=sin(1) (or in the last tests y'(1)=cos(1) ) -consistent mesh. incosisten, inconsistent with Collatz approximation, consistent mesh with the right Neumann bnd - approximated by the backward difference, cetral difference using an extra ghost point, bakcward diff. + extra Taylor expansion term obtained from the differential equation.
    lap1d18.m -solver of the simplest FDM method for linear boundary value ODE problem: -y''=f; y(a)=al y(b)=be - mesh equidistant with h=(b-a)/N -3point stencil -the order of the scheme 2
    testlap2d18.m -tests of the simplest FDM method for linear boundary value PDE problem: -Laplacian u''+c*u=f(x) in (0,pi)^2; u(s)=0 on boundary -consistent mesh. - 5 point stencil - testing the order in discrete norms for a known solution u(x,y)=sin(x)sin(y)
  • Lab 8 and 9 - 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_01; (1/3)*(|x_k-x_{k+1}|+|x_k-x_{k-1}|) for k=l ; (1/6)*|x_k-x_l| for |k-l|=1; assuming x_{-1}=x_0,x_{N+1}=x_N. \int_a^b phi_k'phi_l'dx=0 for |k-l|>1; (|x_k-x_{k+1}|^{-1}+|x_k-x_{k-1}|^{-1}) for k=l; -|x_k-x_l|^{-1} for |k-l|=1 taking $|x_0-x_{-1}|^{-1}=|x_N-x_{N+1}|^{-1}=0$.
    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.
    nodes2pp.m - converts a linear spline represented in the nodal basis to the octave representation of piecewise polynomial functions (using mkpp()) - then we can use ppval() to evaluate the value of the spline at any point
    testfem18.m - linear 1D FEM solver for -au''+cu=f with Dirichlet bc - any grid - we give initial grid and a known solution and we test discrete errors
    testfemNbc18.m - linear 1D FEM solver for -au''+cu=f with Neumnn bc - works ONLY for c>0!!! - - any grid - we give initial grid and a known solution and we test discrete errors
  • Lab 10 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
    FD1dtest.m - octave script with code testing convergence order for FDM discretization of u_t-u_{xx}=0 u(0)=u(pi)=0 u(0,x)=sin(x) - u(t,x)=exp(-t)sin(x) is the solution (the ODE solver is lsode() - octave black box for ODEs)
    FDM1DParab18.m -solver FDM for u_t-u_{xx}=f u(t,a)=uL(t) u(t,b)=uP(t) u(0,x)=u0(x)
    FDM1DParab18DN.m -solver FDM for u_t-u_{xx}=f u(t,a)=uL(t)(left Dirichlet bc) u'(t,b)=uP(t) (right Neumann bc) u(0,x)=u0(x)
    FDMparabtest18.m -convergence order tests for semidiscretized (FDM) equation u_t-u_{xx}=f u(t,a)=0 u(t,b)=0 a=0,b=pi (or Neumann right bc with b=1.5*pi) u'(b,t)=0) u(0,x)=sin(x) with respect to h (u(t,x)=exp(-t)sin(x) )
    FDMparabu0disc18.m -tests for discontinuous u0 u_t-u_{xx}=f u(t,0)=0 u(t,2)=0 u0 a unit function of [0.6,1.8] or a approx. of Delta Dirac at zero, a=-1,b=1

    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

    exEuler18.m - implementation of expicit Euler scheme
    testexEuler18.m - test of explicit Euler in 1 and 2D
    midpoint18.m - implementation of midpoint scheme
    taylor18.m - implementation of Taylor scheme
    testmidpoint18.m - test of midpoint in 1D
    AdamsB218.m - explicit Adams-Bashforth scheme (of order 2)
    testAdamsB218.m - tests of explicit Adams-Bashforth scheme (of order 2)
    Heun18.m - explicit Heun scheme (a Runge-Kutta scheme of order 2)
    predcorr18.m - explicit predictor (1 step of Heun scheme) + corrector (1 step of trapezoid scheme) (is this scheme of order 2?)
    testshoot18.m -shooting method for linear boundary value ODE problem: -y''+y=0; y(0)=1 y(b)=1 (b=1 - shooting works fine, b=20 - shooting does not work at all - why?)
    linshoot18.m -m-file with a function linshoot18() solving the linear boundary value ODE problem: -y''+p(x)y+q(x)y=f(x); y(a)=alpha y(b)=beta

    FDM schemes - simple implementations and tests

    testfdmsex18.m -the simplest FDM method for linear boundary value ODE problem: -y''+y=0; y(0)=1 y(b)=1 works well for b=1 and 20 (or even larger b)
    testlap1d18.m -tests of the simplest FDM method for linear boundary value ODE problem: -y''=sin(x); y(0)=0 y(1)=sin(1) (or in the last tests y'(1)=cos(1) ) -consistent mesh. incosisten, inconsistent with Collatz approximation, consistent mesh with the right Neumann bnd - approximated by the backward difference, cetral difference using an extra ghost point, bakcward diff. + extra Taylor expansion term obtained from the differential equation.
    lap1d18.m -solver of the simplest FDM method for linear boundary value ODE problem: -y''=f; y(a)=al y(b)=be - mesh equidistant with h=(b-a)/N -3point stencil -the order of the scheme 2
    testlap2d18.m -tests of the simplest FDM method for linear boundary value PDE problem: -Laplacian u''+c*u=f(x) in (0,pi)^2; u(s)=0 on boundary -consistent mesh. - 5 point stencil - testing the order in discrete norms for a known solution u(x,y)=sin(x)sin(y)

    FEM 1D 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.
    testfem18.m - linear 1D FEM solver for -au''+cu=f with Dirichlet bc - any grid - we give initial grid and a known solution (zero on bnd) and we get discrete errors - not real!

    FDM 1D tests of parabolic solver

    FD1dtest.m - octave script with code testing convergence order for FDM discretization of u_t-u_{xx}=0 u(0)=u(pi)=0 u(0,x)=sin(x) - u(t,x)=exp(-t)sin(x) is the solution (the ODE solver is lsode() - octave black box for ODEs)
    FDM1DParab18.m -solver FDM for u_t-u_{xx}=f u(t,a)=uL(t) u(t,b)=uP(t) u(0,x)=u0(x)
    FDM1DParabDN18.m -solver FDM for u_t-u_{xx}=f u(t,a)=uL(t)(left Dirichlet bc) u'(t,b)=uP(t) (right Neumann bc) u(0,x)=u0(x)
    FDMparabtest18.m -convergence order tests for semidiscretized (FDM) equation u_t-u_{xx}=f u(t,a)=0 u(t,b)=0 a=0,b=pi (or Neumann right bc with b=1.5*pi) u'(b,t)=0) u(0,x)=sin(x) with respect to h (u(t,x)=exp(-t)sin(x) )
    FDMparabu0disc18.m -tests for discontinuous u0 u_t-u_{xx}=f u(t,0)=0 u(t,2)=0 u0 a unit function of [0.6,1.8] or a approx. of Delta Dirac at zero, a=-1,b=1
    My home page
    Last update: February 19, 2019.