chapter 3

model simulation

Here are the code examples for Chapter 3. Availability of multi-language versions is indicated by a *.

nonlinear, linear and difference equations

  • Example 3.4 solution of a nonlinear equation by various methods.*
  • Example 3.11 solution of an ill-conditioned linear system.*
  • Example 3.15 cobweb plot of a difference equation.*

ode

  • Example 3.25 solve an unstable ordinary differential equation by different methods.*
  • Example 3.28 – see Example 3.25.

finite difference methods

  • Example 3.29 solution of a transport equation by different methods.*
  • Example 3.30 Laplace equation with Neumann boundary condition.*
  • Example 3.31 2D Poisson equation in L-shaped geometry.
  • Example 3.32 2D Poisson equation for electrostatics with different solvers.
  • Example 3.33 1D heat equation with Crank-Nicolson scheme.
  • Example 3.34 1D heat equation with explicit and implicit schemes.
  • Example 3.35 2D wave equation with absorbing boundary conditions.
  • Example 3.36 2D wave equation with very efficient implementation.

finite element methods

  • Example 3.39 2D elctrostatics with Dirichlet conditions.
  • Example 3.40 2D Poisson equation convergence analysis.
  • Example 3.41 2D Poisson equation with Dirichlet and Neumann conditions.
  • Example 3.43 nonlinear elliptic equation with Picard iteration.
  • Example 3.44 nonlinear elliptic equation with Newton iteration.
  • Example 3.45 nonlinear elliptic equation with additive term.

stochastic simulation (monte-carlo methods)

  • Example 3.46 Monte-Carlo integration.*
  • Example 3.47 Monte-Carlo integration–convergence study.
  • Example 3.48 importance sampling for variance reduction.
  • Example 3.49 rejection sampling for variance reduction.
  • Example 3.56 Metropolis-Hasting MCMC for computing a posterior.
  • Example 3.57 – see Example 3.56.
  • Example 3.58 Simple MCMC for a Gaussian posterior.

stochastic differential equations