Chapter 13

A Small Numerical Project

Build one complete numerical project: generate repeatable noisy measurements, recover a line's slope by finite search, inspect the evidence, and preserve a result that another reader can understand and rerun.

You will begin with a question and a known data-generating process. You will then define the inputs and outputs, generate repeatable noisy data, compare candidate slopes, inspect the fitted line, and save enough information to rerun the work.

The mathematics is deliberately small. The aim is to practise the complete working process around a numerical result: state the question, separate the stages, check assumptions, inspect evidence, record the run, and report what the result does and does not show.

By the end, the code should read as one connected investigation rather than a collection of unrelated examples. This is the same basic discipline used in larger machine-learning projects.

After this chapter

  • Turn a numerical question into a project with distinct configuration, data, computation, inspection, and reporting stages.
  • State the inputs, outputs, and assumptions that determine whether the result is meaningful.
  • Generate repeatable noisy linear data from a known process.
  • Fit a line by comparing candidate slopes with mean squared error.
  • Inspect the fitted result numerically and visually before accepting it.
  • Record the configuration and result so the project can be rerun and compared.
  • Write a concise report that explains the question, method, evidence, result, and limitations.

Lessons

Lessons
7 lessons
Exercises
45 exercises
  1. 01
    Defining the Project

    Turn a numerical question into a clear workflow with visible configuration, data, computation, inspection, and reporting.

    5 exercises
  2. 02
    Inputs, Outputs, and Checks

    Identify the values the project receives and produces, then check the assumptions that make its results meaningful.

    5 exercises
  3. 03
    Generating Repeatable Noisy Data

    Create synthetic measurements from a known line and add seeded noise so the same data can be regenerated.

    5 exercises
  4. 04
    Fitting a Line by Search

    Compare candidate slopes with mean squared error and select the line with the smallest measured error.

    5 exercises
  5. 05
    Inspecting the Fitted Result

    Compare the fitted line with the measurements in a plot and inspect where a single loss value can hide mistakes.

    5 exercises
  6. 06
    Recording and Rerunning the Project

    Save the settings and result together, then rerun the project to check which parts should repeat.

    5 exercises
  7. 07
    Writing the Project Report

    Present the question, method, evidence, result, and limits so another reader can understand and rerun the work.

    5 exercises

Review and practice

  1. Review

    Review how a numerical question becomes a repeatable project with checks, evidence, and a recorded conclusion.

  2. Exercises

    Build and examine small numerical projects that combine data generation, computation, plotting, and reporting.