warming up your workspace

Scientific Computing in Julia

Learn the numerical methods behind science and engineering in Julia, the language built for them. Build floating-point intuition, linear algebra, root-finding, interpolation, quadrature, ODE solvers, optimization, and Monte Carlo from scratch with Base Julia and LinearAlgebra, then assemble them into a real simulation.

10 projects, 250 hands-on levels, run in your browser.

Syllabus

  • Julia for Scientific Computing: The tools you reach for in every numerical program. Define functions, work with vectors and the broadcasting that makes Julia feel like math, control flow, and the numeric types that scientific code lives on. By the end you can express a formula, sweep it over an array, and reduce the result, fluently.
  • Floating Point and Error: Real numbers do not fit in a computer; floating point is the compromise, and every numerical method lives with its rounding. Build intuition for machine epsilon and the gaps between representable numbers, see how subtraction can destroy precision (catastrophic cancellation), sum long lists without losing digits, and watch series converge. This is the bedrock under everything that follows.
  • Linear Algebra: Linear algebra is the language of scientific computing, and Julia speaks it natively. Build vector and matrix operations from scratch, solve linear systems with Gaussian elimination and back substitution, test matrix structure, then meet the LinearAlgebra standard library that does it all fast. Matrices here are written rows-first, like `[1.0 2.0; 3.0 4.0]`.
  • Root Finding: Solving f(x) = 0 is everywhere in science: equilibria, intersections, inverse problems. Build the classic solvers from scratch, bisection's guaranteed bracketing, Newton's quadratic speed, the secant and fixed-point iterations, and Horner's rule for polynomials. Functions are values in Julia, so each solver simply takes the function f as an argument.
  • Interpolation and Fitting: Data comes as samples; science needs the values in between and the trend underneath. Interpolate with straight lines and Lagrange polynomials to pass exactly through points, then fit a least-squares line that captures the trend through noise. These are the tools that turn a table of measurements into a usable function.
  • Numerical Integration: Most integrals have no closed form, so we approximate the area under a curve by sampling. Start with rectangle rules, sharpen to the trapezoidal and Simpson's rules, reach the remarkable accuracy of Gaussian quadrature, then apply them to averages, arc length, and area between curves. Each method trades a little more work for a lot more accuracy.
  • Differential Equations: Differential equations describe how things change: motion, decay, growth, oscillation. Since most cannot be solved on paper, we march the solution forward in small steps. Build Euler's method, then the far more accurate Runge-Kutta family, extend to systems for oscillators and predator-prey models, understand stability, and solve real physics. The ODE is supplied as a function f(t, y) = dy/dt.
  • Optimization: Finding the lowest point of a function powers curve fitting, machine learning, and engineering design. Start with derivative-free line searches, build gradient descent and Newton's method, extend to many variables with numerical gradients, then fit models by minimizing error. Functions and their gradients are computed numerically, so any f you can write, you can minimize.
  • Monte Carlo Methods: When a problem is too tangled to solve directly, sample it. Monte Carlo methods estimate integrals, areas, and probabilities by averaging over random draws, and they shine in high dimensions where everything else fails. Build random number tools, estimate pi by throwing darts, sample from distributions, simulate random walks, and apply it all. Every result is seeded, so your runs are reproducible.
  • Capstone: The Heat Equation: Bring the whole track together to solve a partial differential equation: heat diffusing along a rod. Build the finite-difference Laplacian, derive the stability limit, march the temperature forward in time with an explicit scheme, handle fixed and insulated boundaries and heat sources, then validate the solver against the physics it models. This is scientific computing end to end.

Key concepts

  • Back substitution: Solving an upper-triangular system by working from the last equation upward: the bottom unknown is immediate, and each earlier one follows by substituting the…
  • Bisection method: A bracketing root finder: given an interval where f changes sign, repeatedly halve it and keep the half that still brackets the root. Slow (one bit of accuracy…
  • Box-Muller transform: A method that turns two uniform random numbers into a standard normal (Gaussian) sample using a square root, logarithm, and cosine. The simplest way to generat…
  • Broadcasting: Julia's mechanism for applying a function or operator elementwise over arrays, written with a dot: xs .^ 2 , a .+ b , or f.(xs) . It fuses chains of dotted…
  • Catastrophic cancellation: The loss of significant digits when subtracting two nearly equal floating-point numbers: their leading digits cancel and only the noisy trailing bits remain. A…
  • CFL condition: The stability limit for explicit schemes on time-dependent PDEs, named after Courant, Friedrichs, and Lewy. For the explicit heat equation it requires the diff…
  • Coefficient of determination (R-squared): A goodness-of-fit measure equal to 1 minus the ratio of residual variance to total variance. It is 1 for a perfect fit and 0 when the model does no better than…
  • Condition number: A measure of how much a problem amplifies input error into output error. A well-conditioned problem (condition number near 1) is insensitive to perturbations;…
  • Diffusion: The spreading of a quantity from high to low concentration, smoothing sharp features over time. Modeled by the heat equation, it conserves total amount under i…
  • Discrete Laplacian: The finite-difference form of the second derivative, u[i-1] - 2*u[i] + u[i+1], which measures local curvature. It is the spatial operator at the heart of the h…
  • Dot product: The sum of elementwise products of two vectors, a1 b1 + a2 b2 + ..., the single most-used operation in linear algebra. It gives lengths (a vector dotted with i…
  • Eigenvalue: A scalar lambda for which a matrix A has a nonzero vector v with A v = lambda v: the matrix merely scales v rather than rotating it. Eigenvalues reveal stabili…
  • Euler's method: The simplest ODE solver: step along the current slope, y_next = y + h*f(t, y). First-order accurate (error proportional to the step size h), it is the conceptu…
  • Finite difference: Approximating a derivative by a difference of nearby function values, like (f(x+h) - f(x-h))/(2h) for the first derivative. The basic tool for turning differen…
  • Fixed-point iteration: Recasting f(x) = 0 as x = g(x) and simply iterating x -> g(x). It converges to a fixed point when g is a contraction (|g'| < 1 there). The Babylonian…
  • Floating point: The finite, binary approximation of the real numbers a computer actually stores (Float64 by default). Numbers are spaced unevenly, so most values carry a small…
  • Gaussian elimination: The standard direct method for solving Ax = b: use row operations to reduce A to upper-triangular form (applying the same operations to b), then solve by back…
  • Gaussian quadrature: Integration that chooses both the sample points and their weights optimally, reaching very high accuracy with very few function evaluations. Two-point Gauss-Le…
  • Golden-section search: A derivative-free line search that brackets a one-dimensional minimum and shrinks the bracket using probes placed at the golden ratio, discarding the worse sid…
  • Gradient: The vector of partial derivatives of a multivariable function, pointing in the direction of steepest increase. Its magnitude is near zero at a minimum, so the…
  • Gradient descent: An iterative minimizer that steps against the gradient (the direction of steepest increase), scaled by a learning rate: x -> x - lr*grad. The workhorse of m…
  • Heat equation: The partial differential equation u_t = alpha*u_xx that governs how heat (or any diffusing quantity) spreads over time. Solved numerically by discretizing spac…
  • Horner's rule: An efficient, numerically stable way to evaluate a polynomial by nesting the multiplications: ((c1*x + c2)*x + c3).... It uses the fewest operations and can pr…
  • Interpolation: Constructing a function that passes exactly through a set of sample points, then evaluating it between them. Linear interpolation connects samples with straigh…
  • Kahan summation: A compensated summation algorithm that carries a running correction for the low-order bits lost at each addition, recovering most of the precision a naive left…
  • Lagrange interpolation: Building the unique degree-(n-1) polynomial through n points as a weighted sum of basis polynomials, each one equal to 1 at its own node and 0 at the others. A…
  • Law of large numbers: The principle that the average of many independent samples converges to the true expected value. It is what makes Monte Carlo estimation work: more samples mea…
  • Learning rate: The step-size factor in gradient descent. Too small and convergence crawls; too large and the iteration overshoots and diverges. Choosing it well is the centra…
  • Least squares: Fitting a model to noisy data by minimizing the sum of squared residuals rather than passing through every point. For a straight line this yields closed-form s…
  • Linear regression: The least-squares fit of a straight line y = m*x + b to data. The line always passes through the centroid of the points, and its slope is the covariance of x a…
  • Linear system: A set of linear equations written Ax = b, asking which vector x the matrix A maps to b. Solving it is the central problem of computational linear algebra, appe…
  • Machine epsilon: The gap between 1.0 and the next representable floating-point number, about 2.2e-16 for Float64. It sets the relative precision of arithmetic: adding anything…
  • Matrix: A two-dimensional array, written rows-first as [1.0 2.0; 3.0 4.0] . Indexed A[i,j] , sized by size(A,1) and size(A,2) , and central to linear algebra: matrix-v…
  • Monte Carlo method: Estimating a quantity by averaging over many random samples, with error that falls like one over the square root of the sample count regardless of dimension. U…
  • Multiple dispatch: Julia's core design: a function's behavior is chosen from the types of all its arguments, not just the first. It lets generic numerical code specialize…
  • Newton's method: A fast root finder that follows the tangent line to its x-intercept: x_next = x - f(x)/f'(x). Near a simple root it roughly doubles the number of correct d…
  • Norm: A measure of a vector's length. The Euclidean (2-) norm is the square root of the sum of squared components; the infinity norm is the largest absolute comp…
  • Numerical integration: Approximating a definite integral (the area under a curve) by sampling the integrand, since most integrals have no closed form. Also called quadrature; methods…
  • Numerical stability: Whether the errors in a numerical scheme stay bounded or grow without limit. For explicit ODE and PDE solvers, stability requires a small enough step; exceedin…
  • Optimization: Finding the input that minimizes (or maximizes) a function. Methods include derivative-free line searches, gradient descent, and Newton's method; it powers…
  • Ordinary differential equation (ODE): An equation relating a quantity to its rate of change, dy/dt = f(t, y), describing motion, decay, growth, and oscillation. Solved numerically by marching the s…
  • Random walk: A path built from random steps, the simplest model of diffusion, finance, and noise. After n unit steps its root-mean-square displacement grows like the square…
  • RK4: The fourth-order Runge-Kutta method, which blends four slope evaluations (at the start, twice at the midpoint, and at the end) per step. It is far more accurat…
  • Root finding: Solving f(x) = 0 for a function f. The core scientific-computing task behind equilibria, intersections, and inverse problems, attacked with bracketing methods…
  • Runge-Kutta methods: A family of ODE solvers that sample the slope at several points within a step and combine them for higher accuracy. The classic fourth-order member, RK4, is th…
  • Secant method: A root finder that approximates Newton's derivative with the slope through the last two points, so no derivative is required. It converges almost as fast a…
  • Simpson's rule: A quadrature rule that fits parabolas through pairs of intervals, achieving fourth-order accuracy and integrating any cubic exactly. A large accuracy gain over…
  • Stiffness: A property of ODEs that contain very fast-decaying components alongside slow ones, forcing explicit methods to take tiny steps for stability even when the solu…
  • Trapezoidal rule: Approximating an integral by connecting samples with straight lines and summing the trapezoid areas. Exact for linear integrands and second-order accurate in g…
  • Type stability: Writing functions whose output type is predictable from their input types, so Julia's just-in-time compiler can generate fast, specialized machine code. Th…
  • Vector: A one-dimensional array, the workhorse of numerical code. Julia vectors are 1-indexed ( v[1] is the first element, v[end] the last) and column-oriented, and th…