# Scientific Computing in Practice

Mathematics I · Scientific Programming · https://tryals.app/learn/mathematics-i/scientific-computing-in-practice

## ## Scientific Computing Workflow

Computation is the **third pillar** of science, turning complex real-world problems into trustworthy numerical answers.

| Pipeline Stage | Action & Purpose |
| --- | --- |
| **1. Model** | Translate real systems into mathematics, often **differential equations** or optimization. |
| **2. Discretise** | Replace continuous models with finite approximations (grids, finite unknowns). |
| **3. Solve** | Apply root-finders, linear solvers, and time-stepping using vectorised libraries. |
| **4. Validate** | Check against known cases, assessing **error** and **stability** via grid refinement. |
| **5. Interpret** | Turn raw numbers into scientific understanding and visualisation. |

Every unit theme matters here: floating-point limits bound accuracy, stability decides trust, and vectorisation makes large problems feasible.

## ## The Validation Imperative

**Numerical results are approximate and must be validated**. A simulation produces numbers no matter what; the scientist's job is to know how accurate they are and where they might fail.

> **Common pitfall:** treating a **simulation's output as reliable truth without validation**. A numerical model can be wrong from discretisation error, instability, ill-conditioning, or bugs.

The **workflow** requires a strict validation step. Checking against conservation laws and experiments transforms unverified code into a credible scientific result. Blind trust is as unscientific as a blank page.

## Practice questions

8 of this lesson's 13 practice questions, with answers. The full set is in the app.

### 1. Order the stages of the scientific computing workflow.

**Answer:**

1. Model the real problem as mathematics
2. Discretise the continuous model onto a finite grid
3. Solve the resulting discrete system numerically
4. Validate against known cases and check convergence
5. Interpret and visualise the results

**Why:** Model, discretise, solve, validate, interpret. Skipping validation is the standard failure: a simulation always produces numbers, so the only thing distinguishing a result from an artefact is the checking done after the solve.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/order-the-stages-of-the-scientific-computing-workflow

### 2. A three-dimensional simulation halves its grid spacing in all three directions and also halves its time step. By what factor does the total amount of work grow?

**Answer:** 16

**Why:** Eight times as many cells, each advanced through twice as many time steps, gives a factor of 16. This is why resolution is so expensive in three dimensions and why numerical efficiency is not a luxury.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/a-three-dimensional-simulation-halves-its-grid-spacing-in-all-three

### 3. A second-order scheme has an error of 0.08 on the current grid. Refining the grid by a factor of 2 changes the error to what value?

**Answer:** 0.02 (within ±0.001)

**Why:** 0.08 / 4 = 0.02. Observing exactly this factor of 4 in practice is how you confirm the scheme is genuinely second order, a convergence check that catches implementation bugs no unit test would find.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/a-second-order-scheme-has-an-error-of-0-08-on-the-current-grid

### 4. If halving the step size leaves the answer essentially unchanged, the answer is correct.

**Answer:** False

**Why:** False. Refinement-independence shows the *discretisation* error is small, the answer has converged, but it says nothing about whether the equations, boundary conditions or units were right. A convergence study catches step-size error and nothing else; a wrong model converges beautifully to a wrong answer.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/if-halving-the-step-size-leaves-the-answer-essentially-unchanged-the

### 5. A simulation reproduces the experimental data closely. Why is that weaker evidence of correctness than it appears?

A. Because enough free parameters can be tuned to fit almost anything
B. Because experimental data always contains errors that the model should not match
C. Because simulations cannot be compared with experiments directly
D. Because agreement means the model is overfitted by definition

**Answer:** A. Because enough free parameters can be tuned to fit almost anything

**Why:** Fitting data you tuned against is nearly guaranteed, so the informative test is prediction, hold data back, or forecast a regime the model never saw. Von Neumann's line applies: with four parameters he could fit an elephant, and with five make it wiggle its trunk.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/a-simulation-reproduces-the-experimental-data-closely-why-is-that

### 6. Sort each claim by whether the computation described actually justifies it.

**Answer:**

- Justified: The scheme reproduces the known analytic solution to five digits, Total energy stays constant to within round-off across the run, Halving the grid changes the answer by less than the required tolerance
- Not justified: The simulation ran without errors, so the answer is right, The output numbers look plausible

**Why:** Agreement with an exact solution, conservation of a known invariant, and grid convergence are all real evidence. Running without errors and looking plausible test nothing, a confident wrong answer passes both.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/sort-each-claim-by-whether-the-computation-described-actually

### 7. A simulation can produce plausible-looking output while being completely wrong. What distinguishes verification from validation, and why are both needed?

A. Verification asks if the code implements the model; validation, if the model fits reality.
B. They are two names for the same process, applied before and after publication.
C. Verification checks the output looks reasonable, while validation checks it against another simulation.
D. Verification is done by the programmer and validation by the user, so they differ only in who performs them.

**Answer:** A. Verification asks if the code implements the model; validation, if the model fits reality.

**Why:** Verification asks whether we are solving the equations right; validation asks whether they are the right equations, and they catch different failures. A flawless implementation of a model missing a force runs cleanly and produces confident nonsense. Which is why plausible output is weak evidence, a simulation is *built* to produce it, so 'the results look reasonable' begins the checking.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/a-simulation-can-produce-plausible-looking-output-while-being

### 8. Select every legitimate way to validate a numerical result.

A. Refine the grid and confirm the answer converges
B. Compare with an exact solution in a special case
C. Check that a conserved quantity stays constant
D. Confirm the program produced output without crashing
E. Observe that the resulting plot looks smooth

**Answer:** A. Refine the grid and confirm the answer converges; B. Compare with an exact solution in a special case; C. Check that a conserved quantity stays constant

**Why:** Exact special cases, conserved quantities and grid convergence each test the answer against something external. Not crashing and looking smooth are properties of the run and the picture, and a confidently wrong computation satisfies both.

Page: https://tryals.app/practice/mathematics-i/scientific-computing-in-practice/select-every-legitimate-way-to-validate-a-numerical-result
