Install R (and optionally Python or Rust)
The course is taught in R: install it first. The exercises also show every code example, hint and solution in Python and Rust, so if you prefer one of those you can work the exercises in it; install it as well in that case.
R
- Install a recent R (4.3 or newer) from CRAN.
- We recommend RStudio Desktop as editor.
- Install the packages used in the course:
install.packages(c(
"tidyverse", # data wrangling and plotting
"Matrix", # dense and sparse matrices (ships with R)
"deSolve", # ordinary differential equations (Part 8, Part 11)
"rootSolve", # steady states of ODE models (Newton for systems, phase plane)
"numDeriv", # numerical gradients, Jacobians and Hessians (Parts 7 and 10)
"irlba", # a few singular vectors of a big matrix (eigen algorithms)
"RSpectra", # a few eigenvalues of a big sparse matrix (eigen algorithms)
"nnls", # non-negative least squares (SVD and deconvolution)
"minpack.lm", # Levenberg-Marquardt fitting (nonlinear least squares)
"lpSolve", # linear programming (flux balance analysis)
"pracma" # textbook numerical methods (for comparison)
))Python (optional)
- Install Python 3.11 or newer, e.g. via Miniforge.
- Any editor works; VS Code and JupyterLab are common choices.
- Install the packages used in the course:
pip install "scipy>=1.15" numpy matplotlib pandasRust (optional)
- Install Rust with rustup.
- Get the course’s Rust project, which contains every Rust solution as a runnable example, from the course repository (folder
rust/), and build it once to download the crates:
cd rust
cargo build --examples
cargo run --example install_checkCheck it works
A <- matrix(c(2, 1, 1, 3), nrow = 2)
b <- c(1, 2)
solve(A, b) # should print 0.2 0.6
0.1 + 0.2 == 0.3 # FALSE: see How computers store numbersimport numpy as np
A = np.array([[2.0, 1.0], [1.0, 3.0]])
b = np.array([1.0, 2.0])
print(np.linalg.solve(A, b)) # should print [0.2 0.6]
print(0.1 + 0.2 == 0.3) # False: see How computers store numbers// rust/examples/install_check.rs
use nalgebra::{matrix, vector};
fn main() {
let a = matrix![2.0, 1.0;
1.0, 3.0];
let b = vector![1.0, 2.0];
let x = a.lu().solve(&b).unwrap();
println!("{:?}", x.as_slice()); // should print [0.2, 0.6]
println!("{}", 0.1 + 0.2 == 0.3); // false: see How computers store numbers
}If that prints without error, you are ready for the course!