Foundation module

Programming and Computation

Use code as an engineering tool: variables, functions, arrays, plots, numerical checks, and reproducible notebooks.

Course outline only for now. Full chapter-level lessons are still in progress. Use this page for readiness, concepts, worked-example format, practice, review, and portfolio direction. Complete course contents are live today for Math, Physics, and Statics.

01

Readiness check

Before starting, confirm the prerequisite habits.

  • Use variables and arithmetic expressions.
  • Read a table or CSV conceptually.
  • Understand loops or vectorized arrays.
  • Explain why a plot is an engineering check.
0 or 1 weak itemContinue, but slow down at the worked example.
2 weak itemsReview the foundation page linked in the roadmap before solving practice problems.
3 or more weak itemsStep back to prerequisites; this module depends on them.
02

The core idea

Write small programs that calculate, plot, and verify engineering quantities.

Engineering programming is about turning a physical model into a reproducible computation: clean inputs, vectorized math, and a result you can check against a hand calculation, not clever syntax.

s = sum(v dt)
Works when: the code mirrors the physical model and you validate its output against a known hand calculation.
Breaks down when: you trust a plot from code you never checked against a closed-form or limiting case.
Figure 1. Concept model for Programming and Computation. The figure names inputs, computed variables, geometry, and result.
input/load result/constraint computed variable dimension/model geometry
03

The method

1Model

Make the physical situation visible.

2Relate

Translate the model into symbols.

3Solve

Calculate only after the model is clear.

4Check

Use units, scale, and limiting cases.

04

Worked example

Figure 2. Worked problem setup: A sensor reports velocity every 0.01 s for 2 s. Estimate displacement by summing v dt after cleaning one bad sample.
Figure 3. Calculation model. The result follows from the model, units, and reasonableness check.

A sensor reports velocity every 0.01 s for 2 s. Estimate displacement by summing v dt after cleaning one bad sample.

  1. Problem A sensor reports velocity every 0.01 s for 2 s. Estimate displacement by summing v dt after cleaning one bad sample.
  2. Given and find dt = 0.01 s, 201 velocity samples, one physically impossible sample. Find: A reproducible displacement estimate and a plot that exposes the bad sample.
  3. Assumptions Idealized model, consistent units, and no hidden effects outside the stated scope.
  4. Step Load the data, plot it, and flag the impossible spike before computing.
  5. Step Replace the bad sample only if a documented rule justifies it.
  6. Step Compute displacement with sum(v dt).
  7. Step Report the cleaning rule and compare with expected speed scale.
  8. Conclusion script, plot, and check. Carry this result into the design decision, not just into the answer box.
05

Misconceptions and diagnostics

MistakeSymptomDiagnostic questionCorrection
No validation caseTrusts output with no checkWhat hand calculation confirms this?Test against a case you can solve by hand.
Unit or scale bugsResult off by powers of tenAre array units consistent?Carry units in comments; check magnitudes.
Off-by-one indexingA sum or loop misses an endpointDid you integrate over the full range?Verify array bounds against the physical interval.
06

Practice ladder

Level 1: direct skill

Redo the worked example with one changed input. Predict the trend before calculating.

Check yourself

The trend must match the governing relation: s = sum(v dt).

Level 2: mixed concept

Draw the model from memory, label knowns and unknowns, then write the first equation without looking.

Check yourself

Your first equation should connect the model to verified result.

Level 3: independent problem

Create a similar problem from a real object near you. State assumptions, solve it, and include a reasonableness check.

Check yourself

A valid solution has a sketch, given/find list, governing relation, units, and a conclusion.

Level 4: transfer task

Turn the result into a design decision: what would you change if the output missed its target by 25 percent?

Check yourself

Name the design variable with the strongest influence and justify it from the equation.

07

Working with AI, and proving it yourself

Useful AI role

Ask for a critique of assumptions, units, diagram labels, and missing checks after you have attempted the solution.

Do not outsource

Do not paste the problem and accept a final answer. Your evidence is the model, the checks, and the explanation.

08

Retrieval and spaced review

Closed-notes prompts: state the physical model, write the computation that implements it, name the validation case, and check the result's magnitude and units.

TodayRedo the worked example from a blank page.
+1 daySolve Level 1 without notes.
+3 daysSolve Level 2 with changed numbers.
+7 daysConnect this module to another course.
+30 daysAdd a portfolio artifact.
09

Mapping and portfolio task

Course mapping

Programming is the lever for every quantitative course: the numerical integration s = sum(v dt) here is the same primitive that powers your dynamics, controls, and data-analysis work.

First-pass focus: definitions, model setup, units, and worked examples. Save edge cases for the second pass.

Portfolio task

Create a one-page computation note (physical model, code, and a validation case): sketch, assumptions, equations, result, reasonableness check, limitation, and recommendation.