Mathematical Physics II (Practical)



:: Home : CV : Teaching : Research : Publications : Presentations : Leisure ::


Lectures

  • Lecture 01. [Recapitulation]
  • Lecture 02. [NumPy Array]
  • Lecture 03. [SciPy]
  • Lecture 04. [Numerical Integration]
  • Lecture 05. [Ordinary Differential Equation]
  • Lecture 06. [Curve Fitting]

Codes

Plots

  1. Plot 01:
  2. Plot 02:
  3. Plot 03:
  4. Plot 04:

Remarks

  1. See Numpy Lecture 1 and Lecture 2 by Prof. Ananda Dasgupta. Here are presentations by Prof. Abhijit Kar Gupta.
  2. CU Question Set for a few years.
  3. Use Pydriod from Android PlayStore to practice codes on your cellphone.

Topics

  1. Introduction to numpy and scipy:
    • The numpy array:
      • properties: size, shape, ndim, dtype.
      • creating arrays:
        • zeros, one(), full(), fill().
        • arange(),linspace(),logspace().
        • identity(), eye().
        • astype().
      • Indexing and slicing arrays (view versus copy).
      • Important array methods:
        • reshape(), ravel(), flatten().
        • hstack() and vstack().
      • Element wise functions:native numpy functions,the vectorise() method.
      • Aggregate functions np.sum(),np.prod(),np.mean(),np.std(),np.var(),np.min(),np.max(), np.argmin(), np.argmax().
    • Using numpy for matrix operators (the 2D numpy array):
      • addition, multiplication(dot).
      • Gauss elemination (using partial pivoting)(numpy code):
        • for evaluating the determinant.
        • for solving linear equation.
      • The numpy linalg module:
        • solving equations: (a) mesh equations of electric circuits (3 meshes), (b) coupled spring mass systems (3 masses).
        • diagonalisation.
    • Scientific Applications:
      • Interpolation: Using both numpy and scipy.interpolate(for visualization of the results use matplotlib) -basic numerical analysis theory to be explained.
        • Lagrange Interpolation.
        • Newton Forward Interpolation.
      • Numerical Integration:(for both functions and equi-spaced data):
        • Trapezoidal rule.
        • Simpson’s one-third rule. Using both numpy and scipy.integrate.quad(), scipy.integrate.trapz(), scipy.intgrate.simps() - basic numerical analysis theory to be explained.
        • Numerical Integration by n-point Gaussian Quadrature method. [Basic theory and numpy code - nodes and weights to be read from files, Integration by scipy.integrate.quad().]
      • Solution of ODE:
        • Solution of 1st order and 2nd order ordinary differential equation using 4th order Runge Kutta (RK4) algorithm [algorithm and numpy code - detailed theory not required]
      • Curve fitting:
        • With numpy polynomials.
        • With user defined functions using scipy.optimize module.
  2. Introduction to matplotlib (Using the pyplot submodule):
    • figure, axes, subplot.
    • plot(), scatter(), show().
    • labels, legends, titles, styles, ticks.
    • dynamically updating curves.
    • saving graphs.

Study Materials

  1. Accuracy and Stability of Numerical Algorithms - Nicholas J. Higham.
  2. Python for Scientists - John M. Stewart (2nd Edition) (Numpy).
  3. Matplotlib Plotting Cookbook - Alexandre Devert. (Matplotlib).
  4. Programming for Computation-Python - Svein Linge & Hans Petter Lantangen.
  5. Computatioal Physics problem solving with Computers - Landau, Paez, Bordeianu.
  6. Introduction to Numerical Programming - Titus Adrian Beu. (Integration).
  7. Scientific Computing in Python - Abhijit Kar Gupta.