ENG 401 · Engineering Mathematics VI (Mathematical Modelling and Operation Research)
Our notes
2 min readWhy simulate
Many models cannot be solved by hand: nonlinear, large systems, random inputs. Simulation runs the model on a computer to see how the system behaves.
Numerical solution of ODEs
Euler's method: y_(n+1) = y_n + h f(t_n, y_n).
Simple but needs small steps. Runge-Kutta (RK4) is far more accurate for the same step and is the usual choice.
Worked example: Euler on the cooling model
dT/dt = −0.0693(T − 30), T(0) = 90, step h = 5 minutes.
T(5) ≈ 90 + 5 × (−0.0693 × 60) = 90 − 20.79 = 69.2°C.
Exact: 30 + 60e^(−0.3466) = 30 + 60 × 0.7071 = 72.4°C.
The Euler error (3.2°C) shows the step is too large. With h = 1, five steps give about 71.9°C, much closer.
Check of h = 1: each step multiplies (T − 30) by (1 − 0.0693) = 0.9307; 0.9307⁵ ≈ 0.698; 30 + 60 × 0.698 ≈ 71.9°C.
Monte Carlo simulation
For systems with random inputs:
- Describe each uncertain input by a probability distribution.
- Draw random values for all inputs.
- Run the model; record the output.
- Repeat thousands of times.
- Study the distribution of outputs (mean, spread, probability of failure).
Used for project cost risk, reliability and reserves estimates.
Discrete-event simulation
Models systems as events in time: arrivals at a filling station, jobs on machines. Used when queues are too complex for formulas.
Validation and verification
- Verification: is the model solved correctly? (code checks, simple test cases, mesh refinement).
- Validation: is it the right model? (compare with measurements not used in building it).
Measures: residuals, root-mean-square error, R², plots of predicted against measured.
Sensitivity analysis
How much does the output change when an input changes?
Sensitivity ≈ (change in output ÷ output) ÷ (change in input ÷ input).
Identify inputs that matter most and spend effort measuring them well.
Worked example
In the cooling model, raise k by 10% (0.0693 → 0.0762). Time to reach 40°C: ln 6 ÷ 0.0762 ≈ 23.5 min instead of 25.9 min: a fall of about 9.3%. Sensitivity ≈ −9.3 ÷ 10 ≈ −0.93.
Check: since t = ln 6 ÷ k, t falls by the factor 1 ÷ 1.1 = 0.909, a 9.1% fall; the small difference is rounding. So timing depends almost one-for-one on k.
Software packages
| Tool | Typical use |
|---|---|
| Spreadsheets (Excel with Solver) | Small models, LP, Monte Carlo |
| MATLAB, GNU Octave, Scilab | Numerical modelling, ODEs, control |
| Python (NumPy, SciPy, PuLP) | General modelling, optimisation |
| LINGO, GAMS, TORA | Optimisation |
| Simulink, Aspen, HYSYS, ANSYS | Dynamic, process and finite element simulation |
| Arena, AnyLogic | Discrete-event simulation |
Exams usually ask
- Apply Euler's method for two steps and compare with the exact solution.
- Distinguish verification from validation.
Common mistake
Trusting a simulation because it runs. A model that has not been validated may be precisely wrong.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Simulation
(opens en.wikipedia.org in a new tab)
Wikipedia, Simulation, CC BY-SA 4.0 · licence
-
Monte Carlo method
(opens en.wikipedia.org in a new tab)
Wikipedia, Monte Carlo method, CC BY-SA 4.0 · licence
-
Sensitivity analysis
(opens en.wikipedia.org in a new tab)
Wikipedia, Sensitivity analysis, CC BY-SA 4.0 · licence
-
Verification and validation of computer simulation models
(opens en.wikipedia.org in a new tab)
Wikipedia, Verification and validation of computer simulation models, CC BY-SA 4.0 · licence
-
NOUN MTH 308: Introduction to Mathematical Modelling
NOUN course book (PDF, about 0.9 MB). Modelling method and examples.
(opens nou.edu.ng in a new tab)
Watch
-
Best pick Sensitivity Analysis and Monte Carlo Simulations for an electrical circuit model
5 min · ≈ 23 MB · about ₦13
(opens youtube.com in a new tab)
-
Monte Carlo Simulation & Sensitivity Analysis- Risk ISO31000 - Primavera P6 & MS Project Foundations
18 min · ≈ 81 MB · about ₦45
(opens youtube.com in a new tab)
-
How to Perform Monte Carlo Simulation in Ms. Excel for Risk Analysis?
5 min · ≈ 23 MB · about ₦13
(opens youtube.com in a new tab)
-
Week 9 - Lecture 45: Role of Uncertainty Prediction and Monte Carlo Simulation in PHM
32 min · ≈ 144 MB · about ₦81
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.