Cheatsheet
Floating Point Numbers
Floating Point System Parameters
- System defined by
where: base (usually 2) mantissa digits (precision) exponent bounds
- Normalized form:
where and - IEEE Single Precision (32 bits):
- IEEE Double Precision (64 bits):
Error Measures
- Absolute error:
- Relative error:
significant digits if: - Machine epsilon (round to nearest):
- Machine epsilon (truncation):
Floating Point Arithmetic
- Round-off magnification:
- Catastrophic cancellation occurs when subtracting similar-magnitude numbers
Interpolation & Splines
Polynomial Interpolation
- Lagrange Form:
where: - Warning: High-degree polynomials may oscillate (Runge's phenomenon)
Cubic Splines
- Cubic polynomial on each interval:
- Interpolation conditions:
, - Continuity conditions:
, - Boundary conditions:
- Clamped:
and specified - Natural/free:
- Not-a-knot: Match 3rd derivatives between end segments
- Clamped:
Hermite Interpolation
- Given points and derivatives:
where: ,
Ordinary Differential Equations (ODEs)
First-Order ODE Methods (for , )
| Method | Formula | Error | Stability |
|---|---|---|---|
| Forward Euler | Conditional: |
||
| Backward Euler | Unconditional | ||
| Improved Euler | Conditional: |
||
| Midpoint | Conditional | ||
| RK4 | Conditional |
Higher-Order ODEs
- Convert to system of first-order ODEs using
for
Adaptive Time-Stepping
- Use two methods of different order
- Estimate error:
- Adjust step size:
Error Analysis
- Local Truncation Error (LTE): Error in one step, assuming exact previous data
- Global Error: Total accumulated error, typically one order lower than LTE
- For a method with LTE
, global error is