Computational Science and Engineering

Gilbert Strang

Wellesley-Cambridge Press      (for ordering information)

Book Order Form

Outside North America our distributor is Cambridge University Press

Related websites: , , ,

[CSE Table of Contents] [MATLAB Codes] [Problem Solutions] [FEM Table of Contents]

I hope this website will become a valuable resource for everyone learning and doing Computational Science and Engineering. Here are key links:

** Each section in the Table of Contents links to problem sets, solutions,
** other websites, and all material related to the topic of that section.
** Readers are invited to propose possible links (write to

An Analysis of the Finite Element Method, Second Edition 2008   ( Table of Contents for FEM )

Table of Contents for CSE   ( Codes below )   ( Solutions below )

1   Applied Linear Algebra

1.1 Four Special Matrices
1.2 Differences, Derivatives, and Boundary Conditions
1.3 Elimination Leads to K = LDL^T
1.4 Inverses and Delta Functions
1.5 Eigenvalues and Eigenvectors
1.6 Positive Definite Matrices
1.7 Numerical Linear Algebra: LU, QR, SVD
1.8 Best Basis from the SVD

2   A Framework for Applied Mathematics

2.1 Equilibrium and the Stiffness Matrix
2.2 Oscillation by Newton's Law
2.3 Least Squares for Rectangular Matrices
2.4 Graph Models and Kirchhoff's Laws
2.5 Networks and Transfer Functions
2.6 Nonlinear Problems
2.7 Structures in Equilibrium
2.8 Covariances and Recursive Least Squares
*2.9 Graph Cuts and Gene Clustering

3   Boundary Value Problems

3.1 Differential Equations of Equilibrium
3.2 Cubic Splines and Fourth Order Equations
3.3 Gradient and Divergence
3.4 Laplace's Equation
3.5 Finite Differences and Fast Poisson Solvers
3.6 The Finite Element Method
3.7 Elasticity and Solid Mechanics

4   Fourier Series and Integrals

4.1 Fourier Series for Periodic Functions
4.2 Chebyshev, Legendre, and Bessel
4.3 The Discrete Fourier Transform and the FFT
4.4 Convolution and Signal Processing
4.5 Fourier Integrals
4.6 Deconvolution and Integral Equations
4.7 Wavelets and Signal Processing

5   Analytic Functions

5.1 Taylor Series and Complex Integration
5.2 Famous Functions and Great Theorems
5.3 The Laplace Transform and z-Transform
5.4 Spectral Methods of Exponential Accuracy

6   Initial Value Problems

6.1 Introduction
6.2 Finite Difference Methods for ODE's
6.3 Accuracy and Stability for u_t = c u_x
6.4 The Wave Equation and Staggered Leapfrog
6.5 Diffusion, Convection, and Finance
6.6 Nonlinear Flow and Conservation Laws
6.7 Fluid Mechanics and Navier-Stokes
6.8 Level Sets and Fast Marching

7   Solving Large Systems

7.1 Elimination with Reordering
7.2 Iterative Methods
7.3 Multigrid Methods
7.4 Conjugate Gradients and Krylov Subspaces

8   Optimization and Minimum Principles

8.1 Two Fundamental Examples
8.2 Regularized Least Squares
8.3 Calculus of Variations
8.4 Errors in Projections and Eigenvalues
8.5 The Saddle Point Stokes Problem
8.6 Linear Programming and Duality
8.7 Adjoint Methods in Design

Appendix   Linear Algebra in a Nutshell

MATLAB Codes   (by section of the book)

1.1 sparseKTBCcode.m
1.2 freefixedcode.m
This is a code for Problem 1.2.19: Finite differences for the linear advection-diffusion equation
- D * u_xx + v * u_x = 1 in Homework 1 [1.2.19]
You could test this code with different parameters D, v, h as suggested below.
The code solves and then plots the solutions. It compares the true analytic solution with the solution from finite differences, using (1) centered differences and (2) upwind differences. See sample outputs. It is easy to
* see the matrices K (diffusion) and Del0 or Del_+ (centered/forward) for small N
* see the boundary conditions u(0) = 0 and u(1) = 0
* see whether centered or upwind is more accurate
* make h smaller and see the approximations converge (increase the number of mesh points, N, to make h smaller)
* try different values of the parameters D, v
(i) v=D=1
(ii) v << D (and see the numerical approximation is good, even with large h)
(iii) v >> D (and see a boundary layer because diffusion is so weak)
1.3 thomascode.m
1.5 harmoniccode.m
1.7 SVDcode.m
2.2 normalmodescode.m
2.4 gridresistcode.m
2.6 Elastic Pendulum   ( Trapezoidal Rule   Trapezoidal backward difference split step )
Double Pendulum   ( Trapezoidal Rule   Trapezoidal backward difference split step )
Chaotic Pendulum   ( Trapezoidal Rule   Trapezoidal backward difference split step )
For the trapezoidal-backward difference split-step method, the text refers on page 179 to this graph of stability regions from the paper Optimal Stability for Trapezoidal-Backward Difference Split-Steps by Sohan Dharmaraja, Yinghui Wang, and Gilbert Strang, IMA Journal of Numerical Analysis (2009).
The method is stable outside the curve |growth factor| = 1 in the complex plane. The "magic" choice alpha = 2 - sqrt(2) gives optimal stability.
2.7 trusscode.m   ( needs data files   inputs.txt   bar.txt   bar2.txt )
DistMesh codes
2.9 fiedlercode.m
3.1 FDcode.m
3.2 Bsplinecode.m
3.4 poissoncode.m
3.5 sinetransform.m
3.6 femcode.m
4.6 circdeconvcode.m
4.7 cascadecode.m
DaubechiesWavelets.m DaubechiesWavelets.m, daubechieswavelets.eps, and scalingfunction.eps were generously contributed by Dr Yossi Farjoun.
5.1 taylorcoeffcode.m
5.3 ilaplacecode.m
5.4 rungecode.m
6.1 waveheatairycode.m
6.2 ODEstabilitycode.m
6.3 onewaycode.m
mit18086_fd_transport_growth.m (various finite difference methods for the one-way wave equation with von Neumann growth factor plot)
6.4 PML notes
wave equation notes
adjoint method notes
adjoint method and recurrence notes
mit18086_fd_waveeqn.m (leapfrog method for the wave equation with fixed and loose end)
6.5 convdiffcode.m
mit18086_fd_heateqn.m (finite differences for the heat equation with various time stepping and b.c.)
Advection-Diffusion-Reaction codes
6.6 mit18086_fd_transport_limiter.m (finite difference and finite volume methods with flux limiters for the advection of discontinuous data)
6.7 mit18086_navierstokes.m (finite differences for the incompressible Navier-Stokes equations in a box) Documentation
mit18336_spectral_ns2d.m (2D Navier-Stokes pseudo-spectral solver on the torus)
6.8 mit18086_levelset_front.m (level set method for front propagation under a given front velocity field)
7.1 nestedcode.m
mit18086_poisson.m (solves the Poisson equation in 1d, 2d and 3d)
mit18086_fillin.m (computes the LU decomposition of a 2d Poisson matrix with different node ordering)
7.2 mit18086_smoothing.m (smoothing and convergence for Jacobi and Gauss-Seidel iteration)
mit18086_ilu.m (computes the incomplete LU factorization of a 2d Poisson matrix for different tolerances)
7.3 mit18086_multigrid.m (multigrid solver for a 1d Poisson problem, V- and W-cycle)
7.4 arnoldicode.m
mit18086_cg.m (conjugate gradient method for 2d Poisson problem)
8.2 nullspacecode.m
8.6 simplexcode.m
8.7 LIBOR notes
Automatic Differentiation notes


Problem Solutions   (by section of the book)

Solution to Problem 1.2.8

Solution to Problem 2.3.3 by Dr. Persson

Solution to Problem 2.7.7 by Jesse Belden

Solution to Problems 2.4.11 and 3.1.11 and 3.1.17

Solutions to Fall 2007 Problem Sets can be found on OpenCourseWare.


Each section of the book has a Problem Set.

The text also provides MATLAB codes to implement the key algorithms.

The website links to the course sites and (also All these sites have overview materials with codes to download, plus graphics and exams and video lectures for review.

This page has been accessed at least several times since June 2007. Last updated 4/18/2008.