Numerical Methods in Physics




Syllabus for Computer Physics:

year 23/24



Office hours:

monday, 13:00-14:00, room 318 (3-rd floor), building D7 (new)


Lecture notes

  1. (10 min) General information
  2. (1h) Computer arithmetic and numerical errors
  3. (2h) Solving systems of linear equations with direct methods
  4. (2h) CHANGED - Diagonalization of dense matrices
  5. (1h) CHANGED - Solving systems of linear equations with iterative methods
  6. (1h) Iterative diagonalization of sparse matrices
  7. (1h) Solving systems of nonlinear equations
  8. (1h) Interpolation
  9. (1h) Approximation
  10. (1h) Minimization
  11. (1h) Fast Fourier Transform
  12. (1h) Numerical integration

Example textbooks on numerical methods

  1. (pdf - from AGH ip) A. Quarteroni, R. Sacco, F. Saleri, "Numerical mathematics"
  2. (pdf - from AGH ip) W. Gautschi, "Numerical analysis"
  3. (pdf - from AGH ip) J.Pitt-Francis, J. Whiteley, "A guide to scietific computing in C++"
  4. (pdf - from AGH ip) R.M.Coreless, N. Fillion, "A graduate introduction to numerical methods"
  5. (pdf) Yousef Saad, "Iterative methods for sparse linear systems"
  6. (pdf) Yousef Saad, "Numerical methods for large eigenvalue problems"

Computer laboratory projects

  1. Simple numerical operations with vectors and matrices
  2. Solving system of linear equations using LU decomposition
  3. CHANGED - Diagonalization of tridiagonal matrix
  4. CHANGED - Solving sparse system of linear equations using SOR method
  5. Diagonalization of matrix using power method
  6. Fitting data with SVD decomposition
  7. Solving nonlinear equation with bissection, secant and Newton-Raphson methods
  8. Lagrange polynomial interpolation
  9. Cubic spline interpolation
  10. Pade approximation of Gauss function
  11. Estimation of nonlinear fitting parameters with Conjugate Gradients and Golden Section methods
  12. Application of FFT to noise filtering
  13. Integration in one dimension with Newton-Cotes quadratures
  14. Integration in two dimensions - calculations of electrostatic interaction
    gauss_nodes_weights.c

Link to laboratory class register and report repository on UPEL platform


Notes on the existing rules in laboratory:

In computer labs students carry out the projects relating to simple numerical tasks.
Each project must be performed individually by writing the computer program which
conducts all tasks contained in the project instruction.
Preffered programming language: C/C++.
At the end of the labs the source code and all required numerical results must
be placed on UPEL platform (if you have any problem with sending the data
to UPEL let me know as quickly as possible). For this purpose create
a separate directory containing the source code and the numerical data
and then create an archive file of this directory in zip format
(other formats are not accepted).
Activity of student during individual laboratory is assessed based
on the degree of realization of all tasks and the scale between
0 and 100 points is used. Project is recognized as accomplished after preparing
the report referring to this project. Only the electronic version of report
in PDF format is acceptable. The report must contain:
(i) brief introduction i.e. the description of the numerical method (~ 1 page),
(ii) short description of the numerical task (~0.5 page) solved during the classes,
(iii) compact presentation of the results (figures, tables ) accompanied
with short 2-3 sentences of comments, and,
(iv) conclusions (~ 0.5 page) summarizing student's own observations.
The report shall be placed in UPEL platform within 1 week (7 days)
counting from the end of the last laboratory. Reports are assessed
also in a scale between 0 and 100 points. In case of delay in sending the report,
the amount of points is decreased by 20 for each subsequent week of delay.
In case of excused absence of student on computer laboratory, sending the activity
zip-file is not required and it is not assessed, however student is obliged to realize
the project on his/her own and send the report within a week after he/she attends
the next classes. Unexcused absence are granted by 0 points for activity, student
is still obliged to prepare the report at home and place it in UPEL platform.


Notes about how to use the numerical libraries
in computer laboratory on Taurus Linux server

  1. BLAS library

    It is installed in Taurus server, to use the BLAS routines compile your code using following command

    g++ source_code.cpp -lblas -lm

  2. LAPACKE C wrappers to LAPACK routines.

    Unfortunately an administrator hasn't yet installed this package.
    Therefore we must cope with this issue ourselves. Below there is the link to the compiled library,
    just click on the link and download the archived file.

    lapacke.zip

    In your home directory create new directory "bin", put the downloaded file "lapacke.zip" in it
    and unzip it with command

    unzip lapacke.zip

    Unzipped directory contains the header files in include subdirectory and the library liblapacke.a.
    To compile the C++ source code with the LAPACKE wrapper we need to supply
    the path to the headers files (-I/path flag) and the location of the library (-L/path flag),
    for this purpose use the following command

    g++ -I$HOME/bin/lapacke/include -L$HOME/bin/lapacke source_code.cpp -llapacke -llapack -lblas -lm

    Notice that the compiler links the libraries in the order read from the right to the left
    (first is the mathematical library, then BLAS and LAPACK while LAPACKE is the last one).

    If everything is ok you shall see an executable file in your working directory.
    If you wish to use the LAPACKE wrappers on your home computer, you do not need to compile it manually
    just install an appropriate packages from repository: blas and lapacke-dev.
    All dev packages contain the headers files which must be included during the compliation.
    Usually the headers files and the libraries are placed in the directories which the system
    conventionally searches so you do not need to usually add these paths but you must still inform
    which libraries you use in your program.
    If due to some reasons the libraries are put in non-standard directories,
    then locate the directory with headers files and the library with locate command (Linux systems)

    locate lapacke


Numerical libraries documentation

  1. BLAS C interface (pdf)
  2. LapackE: C interface to Lapack (manual - online)
  3. Lapack: how to use it in Fortran and C/C++
  4. FFTW (manual - online) (manual - pdf)
  5. Math Kernel Library (Intel) (manual - online) (manual - pdf)
  6. GSL - GNU Scientific Library (manual - online) (manual - pdf)
  7. MUMPS: a parallel sparse direc solver (manual - pdf)
  8. ARPACK-ng: large scale eigenvalue solver (manual - pdf)
contact
Dr Hab. Eng. Tomasz Chwiej
AGH University of Krakow
Faculty of Physics and Computer Science
Department of Computer Science and Computer Physics
room 318, building D7, phone:(12) 617 44 71
chwiej@fis.agh.edu.pl