Numerical Methods in Engineering with Python, Jaan Kiusalaas
List of Program Modules (by Chapter)

Source code of modules in Chapters

Chapter 1. Introduction

Chapter 2. Systems of linear algebraic equations

Chapter 3. Interpolation and curve fitting

Chapter 4. Roots of equations

Chapter 5. Numerical Differentiation

Chapter 6. Numerical integration

Chapter 7. Initial value problems

  • 7.2 euler.py Euler's method for solution of initial value problems. It can handle any number of first-order differential equations
  • 7.2 printSoln.py Prints solution of initial value problem in tabular form
    • 7.2 example7_2.py integrate an initial value problem using euler
  • 7.3 runKut4.py Integrate using the Runge-Kutta method of order four
    • 7.3 example7_4.py integrate an initial value problem using rk4 method
    • 7.3 example7_5.py integrate an initial value problem using rk4 method
    • 7.3 example7_6.py integrate an initial value problem using rk4 method
  • 7.5 run_kut5.py Adaptive Runge-Kutta method with Dormand-Prince coefficients
    • 7.5 example7_8.py integrate an initial value problem using the adaptive Runge-Kutta method
    • 7.5 example7_9.py integrate a moderately stiff problem using the adaptive Runge-Kutta method
  • 7.6 midpoint.py Integration with midpoint method with Richardson extrapolation
  • 7.6 bulStoer.py Integration with simplified algorithm for the Bulirsch-Stoer method

Chapter 8. Two-point boundary value problems

  • 8.2 linInterp.py Finds the zero of the linear function f(x) by straight line interpolation
    • 8.2 example8_1.py shooting method example for the boundary value problem y'' + 3yy' = 0 y(0) = 0 y(2) = 1
    • 8.2 example8_3.py shooting method example for the third-order boundary value problem y''' = 2y'' + 6xy    y(0) = 2 y(5) = y'(5) = 0
    • 8.2 example8_4.py Shooting method example for 4th order differential eqs. (supported beam)
    • 8.2 example8_5.py Shooting method example for the differential equation y^(^4^) + 4/x y^3 = 0 with the boundary conditions y(0) = y'(0) = 0 y''(1) = 0 y'''(1) = 1
  • 8.3 Finite Difference Method
    • 8.3 example8_6.py finite difference example for 2nd order linear diff. eqs.
    • 8.3 example8_7.py finite difference example for 2nd order differential. eqs.
    • 8.3 example8_8.py finite difference example for 4th order linear diff. eqs.

Chapter 9. Symmetric matrix eigenvalue problems

  • 9.2 jacobi.py Jacobi method: compute all the eigenvalues λi and eigenvectors xi of a symmetric matrix
  • 9.2 sortJacobi.py Sort the eigenvalues and eigenvectors into ascending order of eigenvalues
  • 9.2 stdForm.py for matrices A and B, returns H and the transformation matrix T = (L−1)T
  • 9.3 inversePower.py Given the matrix A and the shift s, returns the eigenvalue of A closest to s and the corresponding eigenvector
    • 9.3 example9_4.py determine the largest principal eigenvalue by the power method
    • 9.3 example9_5.py determine the smallest eigenvalue and the corresponding eigenvector of a matrix
  • 9.3 inversePower5.py returns the smallest eigenvalue and the corresponding eigenvector of Ax = λBx, where A is a pentadiagonal matrix and B is a sparse matrix
  • 9.4 householder.py Householder reduction to tridiagonal form
    • 9.4 example9_8.py use the function householder to tridiagonalize a matrix
  • 9.4 sturmSeq.py Computes Sturm sequence of tridiagonal matrices
  • 9.4 gerschgorin.py Computes global bounds on eigenvalues
  • 9.4 lamRange.py Brackets the N smallest eigenvalues of a symmetric tridiagonal matrix
  • 9.4 eigenvals3.py Finds m smallest eigenvalues of a tridiagonal matrix
    • 9.4 example9_12.py use eigenvals3 to determine the three smallest eigenvalues of a 100×100 matrix
  • 9.4 inversePower3.py Similar to inversePower before 9.3, but it executes much faster because it exploits the tridiagonal structure of the matrix
    • 9.4 example9_13.py compute the 10th smallest eigenvalue of the matrix A given in example 9.12
    • 9.4 example9_14.py compute the three smallest eigenvalues and the corresponding eigenvectors of a matrix

Chapter 10. Introduction to optimization

  • 10.2 goldSearch.py Golden section search for the minimum of a function
    • 10.2 example10_1.py use goldSearch to find x that minimizes f(x) = 1.6x3 + 3x2 − 2x subject to the constraint x >= 0
    • 10.2 example10_2.py optimization of a section modulus of a beam
  • 10.3 powell.py Powell's method of minimization
    • 10.3 example10_3.py calculate the minimum of the function F = 100(y − x2)2 + (1 − x1)2
    • 10.3 example10_4.py calculate smallest distance from the point (5, 8) to the curve xy = 5
    • 10.3 example10_5.py calculate the minimization of the structural volume (weight) of a truss
  • 10.4 downhill.py Downhill simplex method of minimization
    • 10.4 example10_7.py calculate the minimum length of the wetted perimeter while maintaining a cross-sectional area af a channel
    • 10.4 example10_8.py calculate the minimum volume of the material without violating the frequency constraint of a stepped shaft