Course on computational physics
Slides and programs of the course
Systems of linear equations:
Programs to solve systems of linear equations: Lectures, Programs.
The .tar.gz archive contains the following programs:
Program System.cpp: solves a 3x3 system of linear equations through the algorithm of LU factorization;
Program Sys_scal.cpp: solves a system of linear equations with dimension NxN to analyze the computational complexity of the LU factorization;
Program Sys_ndd.cpp: solves a system of linear equations with dimension NxN but which is NOT diagonally dominant to see how the truncation errors propagate during the computation;
Program Inverse.cpp: computes the inverse matrix of a 3x3 matrix by solving 3 different systems through the LU factorization;
Program Tridiag.cpp: solves a tridiagonal linear system for a 3x3 matrix through the Thomas' algorithm;
Files LUvect.h and LUvect.cpp: class to deal with vectors, used by LUmat and LUtrid;
Files LUmat.h and LUmat.cpp: class to solve NxN generic systems;
Files LUtrid.h and LUtrid.cpp: class to solve generic tridiagonal systems;
File makefile: makefile for all programs in the directory.
Zeros of functions:
Programs to compute the roots of transcendental functions: Lectures, Programs.
The .tar.gz archive contains the following programs:
Program Bisection_example.cpp: finds the root of the equation: exp(x)-3/2=0 by using the bisection method;
Program Newton_example.cpp: finds the root of the equation: exp(x)-3/2=0 and of another (more complicated!) function by using the Newton's method;
File Bisection.h: contains the function 'bisection', which computes the interval containing the root through the bisection method;
File Newton.h: contains the function 'newton', which computes the interval containing the root through the Newton's method;
File makefile: makefile for all programs in the directory.
Integrals:
Programs to compute definite integrals of functions: Lectures, Programs.
The .tar.gz archive contains the following programs:
Program Trapezoidal.cpp: program to compute the integral of the function exp(x) between [0,2] with the trapezoidal rule;
Program Simpson.cpp: program to compute the integral of the function exp(x) between [0,2] with Simpson's rule;
File Integrals.cpp: library of functions for computing integrals with the trapezoidal and Simpson's rule;
File Integrals.h: contains the headers for the functions defined in 'Integrals.cpp';
File Makefile: makefile for all programs in the directory.
- An introduction to python:
Lectures on some introductory topics concerning the python programming language.
HTML version of the ipython notebook containing an introductory lecture to the python programming language;
HTML version of the ipython notebook containing an introductory lecture on numerical and plotting packages.
Fourier:
Programs to perform Fourier analysis:
- PDF file with the Lectures.
- Python library to compute DFTs.
- HTML version of the ipython notebook containing examples of use for "fourier.py".
- The tar.gz archive contains an example (and relative Makefile) of use of the fftw3.3 library.
Ordinary differential equations:
Programs to solve Ordinary Differential Equations (ODE): Lectures, Programs.
The .tar.gz archive contains the following programs:
Program First_order_lin.cpp: program to solve a first order, linear, ODE like: dy(t)/dt = -k y(t);
Program Harmonic_oscillator.cpp: program to solve the differential equation of the harmonic oscillator: d^2 x(t)/dt^2 = -w^2 x(t);
File Makefile: makefile for all programs in the directory.
Examples of solution for ordinary differential equations:
Programs to solve some physical and biological problems as a system of ordinary Differential Equations (ODE) using a second order Runge-Kutta scheme: Lectures, Programs.
The .tar.gz archive contains the following programs:
Program Pendulum.cpp: program to solve the non-linear equation of simple pendulum;
Program Forced_oscillator.cpp: program to solve the differential equation of a forced and damped oscillator;
Program Planets.cpp: program to solve the motion equation of a planet orbiting around a star;
Program Lotka-Volterra.cpp: program to solve the Lotka-Volterra system of equations;
Class RK2.cpp: class declaring some functions useful for making a single step of the second order Runge-Kutta time scheme;
File RK2.h: header file for the RK2 class;
File Makefile: makefile for all programs in the directory.
Boundary value problems:
Programs to solve a general second order boundary value problem with Dirichlet, Neumann and Robin boundary conditions: Lectures, Programs.
The .tar.gz archive contains the following programs:
Program BVP.cpp: program to solve a generic boundary value problem;
Program Chebyshev_polynomials.cpp: example program to solve the Chebyshev equation;
Files LUvect.h and LUvect.cpp: class to deal with vectors, used by LUtrid;
Files LUtrid.h and LUtrid.cpp: class to solve generic tridiagonal systems;
File Makefile: makefile for all programs in the directory.
Partial differential equations:
Programs to solve partial differential equations of parabolic and hyperbolic type: Lectures, Programs.
The .tar.gz archive contains the following programs:
Program Parabolic_equation.cpp: program to solve the diffusion equation with Dirichlet, Neumann and periodic boundary conditions;
Program Hyperbolic_equation.cpp: program to solve the diffusive advection and Burgers' equations with periodic boundaries;
Files input.data.par and input.data.hyp: parameter files for the two programs above;
File read_data.py: python module to read the data produced by the two programs above;
File Makefile: makefile for all programs in the directory.
Spectral methods for partial differential equations:
Programs to solve partial differential equations with a spectral method (the program solves the dissipative Burgers' equation for the Fourier case only!): Lectures, Programs.
The .tar.gz archive contains the following programs:
Program Burgers.cpp: program to solve the dissipative Burgers' equation with periodic boundary conditions;
Files input.data: parameter file for the program above;
File read_data.py: python module to read the data produced by the two programs above;
File Makefile: makefile for all programs in the directory.
Latest exam tests
Returns to the previous page