UNIHIVE

Study Hub UNIPORT ENG 401

ENG 401 · Engineering Mathematics VI (Mathematical Modelling and Operation Research)

Computer simulation, validation and sensitivity

Solving models numerically, Monte Carlo simulation, checking models against reality, and software.

Our notes

2 min read

Why 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:

  1. Describe each uncertain input by a probability distribution.
  2. Draw random values for all inputs.
  3. Run the model; record the output.
  4. Repeat thousands of times.
  5. 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

ToolTypical use
Spreadsheets (Excel with Solver)Small models, LP, Monte Carlo
MATLAB, GNU Octave, ScilabNumerical modelling, ODEs, control
Python (NumPy, SciPy, PuLP)General modelling, optimisation
LINGO, GAMS, TORAOptimisation
Simulink, Aspen, HYSYS, ANSYSDynamic, process and finite element simulation
Arena, AnyLogicDiscrete-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

Watch

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.

All ENG 401 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.