codes
Codes for all examples in the book "A Toolbox for Digital Twins". When multi-language versions are available, they are indicated by a * after the example description.
Code examples for Chapter 1.
- Example 1.3 underfitting and overfitting
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
- Example 3.60 white noise simulation.*
- Example 3.62 Brownian motion simulation.*
- Example 3.63 Ito and Stratonovich stochastic integral evaluation.*
- Example 3.82 Euler-Maruyama method for a linear SDE.*
- Example 3.85 Ornstein-Uhlenbeck equation.*
- Example 3.87 Milstein method for a nonlinear SDE.*
- Example 3.88 Nagumo’s SPDE.
Code examples for Chapter 4.
- Example 4.10 stochastic gradient descent
Code examples for Chapter 5.
supervised learning
- Example 5.5 simple linear regression.*
- Example 5.16 k-nn classifier for iris data.
- Example 5.19 SVM classifier for iris data.
- Example 5.20 SVM regression for lidar data.
- Example 5.21 neural network for squares data.
- Example 5.22 saving and reloading a previously learned model.
- Example 5.23 neural network for fraud detection.
- Example 5.25 naive Bayes classifier.
unsupervised learning
- Example 5.26 simple k-means clustering.
- Example 5.27 simple k-means clustering with tuning.
cross-validation and tuning
- Example 5.30 cross-validation with caret.
- Example 5.31 cross-validation for tuning of k-nn model.
- Example 5.32 tuning and cross-validation of SVM model.
- Example 5.33 further tuning of SVM model.
- Example 5.34 tuning neural networks for regression.
- Example 5.35 tuning neural networks for classification.
Code examples for Chapter 6.
- Example 6.2 underitting and overfitting
- Example 6.3 - see Example 6.2
Code examples for Chapter 8.
- Example 8.5 Duffing’s equation
- Example 8.17 Gauss-Newton method for nonlinear inversion
- Example 8.18 Levenberg-Marquardt method for nonlinear inversion
Code examples for Chapter 9.
- Example 9.8 Gaussian state space model.
- Example 9.12 Kalman filter for Gaussian state space model.
- Example 9.14 extended Kalman filter for noisy pendulum.
- Example 9.18 unscented Kalman filter for 2D navigation.
- Example 9.21 ensemble Kalman filter for Lorenz-63 chaotic system.
- Example 9.22 ensemble Kalman filter for Kuramoto-Sivashinsky turbulent system.
Code examples for Chapter 10.
- Example 10.2 SVD for optimal thresholding
- Example 10.8 optimal matched pursuit for binary signal
Code examples for Chapter 11.
Bayesian estimation
- Example 11.5 Bayesian inference for binomial random variable (influence of priors).
- Example 11.7 Bayesian inference for binomial random variable with beta conjugate priors.
- Example 11.8 Bayesian inference for epidemics.
Bayesian regression
- Example 11.10 Bayesian inference with Gaussian products.
- Example 11.12 Bayesian inference of a mean for air quality data.
- Example 11.13 Bayesian inference for a multivariate Gaussian (linear regression).
- Example 11.14 Bayesian inference for parameters of a noisy pendulum.
- Example 11.15 Bayesian regression and model reduction for diabetes data.
- Example 11.17 Gaussian process regression for a sine function.
Bayesian filters
- Example 11.18 Bayesian sequential regression for a multivariate Gaussian.
- Example 11.19 Bayesian sequential estimation of 2d coordinates.
Bayesian inverse problems
- Example 11.21 Bayesian inversion for 1d heat equation.
Bayesian optimization
- Example 11.22 Bayesian optimization of a 1d function.
probabilistic programming
- Example 11.23 Bayesian inference of a proportion.
- Example 11.24 Bayesian linear regression.
- Example 11.25 Bayesian inverse problems for ordinary differential equations.
Code examples for Chapter 12.
- Example 12.9 basic example from pcalg package