Laplace Equation
∇²φ = 0
Poisson Equation
∇²φ = f
Diffusion Equation
∇²φ - k ∂φ/∂t = 0
Wave Equation
∇²φ - 1/C² ∂²φ/∂t² = 0
Finite Difference for Laplace (Elliptic), uxx(x,y)
uxx(x,y) ≈ 1/h² ( u(x+h, y) - 2u(x, y) + u(x-h, y) )
(Do this for xx and yy then substitute into PDE)
Jacobi Method
Gauss-Seidel Method
(or Liebmann’s Method)
Iterative Methods accuracy criterion
( unew) - uold ) / unew | < ε
Finite difference (explicit) method for Diffusion Equation (Parabolic)
1/k ( u(x, t+k) - u(x, t) ) - 1/h² ( u(x+h, t) - 2u(x, t) + u(x-h, t) ) = 0
- k is timestep
- h is space-step
- r = k/h²
- 2k ≤ h²
u(x, t+k) = r( u(x+h, t) + u(x-h, t) ) + (1-2r) u(x, t)
Crank Nicholson (Implicit) method for Parabolic Equation
1/k ( u(x, t+k) - u(x, t) ) = 1/2h² ( u(x+h, t) - 2u(x, t) + u(x-h, t) ) + 1/2h² ( u(x+h, t+k) - 2u(x, t+k) + u(x-h, t+k) )
- Same as Explicit method, but the uxx part is averaged over 2 time steps
- Timestep k no longer restricted
- Can sometimes cancel out terms on either side if r = k/h² = 1
Newton Raphson for coupled Equations
xn+1 = xn - J-1n fn
How to solve coupled 2nd Order ODEs
Binomial Coefficient Function nCr
nCr = n! / ( r! (n-r)! )
Euler Cromer Method
For coupled ODEs:
Rearrange system to make one variable solve explicitly (FWD Euler)
And one variable solved implicitly (BWD Euler, use gradient for n+1)
e.g. y(n+1) = y(n) + hy’(n)
or y(n+1) = y(n) + hy’(n+1)
To solve you can sub the explicit into the implicit and make a matrix with that and the regular explicit
(A semi-implicit method)
Lagrange Interpolation
Making a polynomial that has the exact correct value for each node specifically, by making all the other terms 0
(x - x1)/(x0 - x1) = 0 for x = x1
Newton’s divided difference interpolation
Just use the formula book, it’s got the differencey things
Remember for backwards, n is negative, so values are y0, y-1, y-2 etc. And y0 is the one that has all the higher order divided differences
Cubic spline interpolation
Use the formula book notes for the equations, just find all the missing variables
Bilinear interpolation
The one with the 4 points in a rectangle, and a simultaneous matrix for all of them
Can do without matrix if you solve generally for two vertical lines, then interpolate the vertical lines
Barycentric Interpolation
Just use the formula book for the equations for finding λ
Can use matrix form A λ = r
- Where r is the interpolated point cartesian coordinates
- A is a matrix where each column is one of the triangular points
- λ is a vector of the 3 barycentric coordinate values
Simpson’s Rule
Used for numerical integration
Requires an even number of subintervals, odd number of nodes
Gauss Quadrature
Used for numerical integration
Use a substitution, sub in expression in t from formula book
Calculate f(t) where f is the original function, but with t subbed in
Compute the nodes & weightings and sum them up
A and B are the integration limits
Forward Euler Method
Solve ODEs that are initial value problems
simply y(n+1) = y(n) + h y’(n)
f(y,t) often used to mean the derivative, y’
Heun’s Method
Improved forward Euler used for ODEs
- Predicts next y, y(n+1) using FWD euler
- Finds gradient at y(n+1)*
- Averages with gradient at y(n)
- Uses this average as the gradient used in FWD euler to get y(n+1)
Runge-Kutta Methods
Like Heun but with as many steps as you want, avergaing many gradients basically