Data often gives you positions at separate times, not a formula for velocity. A finite difference estimates a slope; a sum of small velocity-time rectangles estimates distance.
Think like a programmer
Differentiation is a local change estimate. Integration is an accumulator. Both turn a continuous idea into operations over arrays of samples, so sample spacing becomes part of the API.
Model checklist
Inputs
Position or velocity samples and their time interval.
State
The current accumulated estimate.
Rule
Use nearby samples for slope; add small velocity × time areas.
Output
Estimated velocity or position.
Check
Compare with a constant-acceleration function.
\[v(t)\\approx\\frac{x(t+h)-x(t-h)}{2h}\]
Slope and area from samples
Change sample width to compare finite differences and small-area sums with the exact motion functions.
Velocity from slope
5.000 m/s (exact 5.000)
Position from area
6.625 m (exact 7.000)
At 2 s: velocity estimate 5.000 m/s; position estimate 6.625 m.
Try this experiment
Prediction: Reducing sample interval improves both estimates for this smooth motion.
Compare a 1.00-second interval with a 0.02-second interval. Which estimate changes more, and why does the area sum use velocity at several times?
Where this model breaks
Noisy data makes differentiation especially unstable because subtraction amplifies small changes. Integration also accumulates sensor bias. Smooth or validate data before claiming a physical result.
Summary
Finite differences estimate change; accumulated areas estimate total change. Always name the sample interval and test against a case with a known answer.
Glossary
Derivative: instantaneous rate of change.
Integral: accumulated change over an interval.
Finite difference: a slope estimated from discrete values.
Self-check
Which samples does the central difference use?
What does velocity multiplied by time estimate?
Why is noisy position data hard to differentiate?
Sources
R. L. Burden and J. D. Faires, Numerical Analysis.
Model contract
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.
Implement the idea as a model
For Numerical Differentiation and Integration, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In One-Dimensional Motion, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Guided experiment
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
Where this model breaks
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Summary
Treat Numerical Differentiation and Integration as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Glossary
Input: a measured value or chosen parameter supplied to a model.
State: the smallest set of values needed to continue or reproduce a model.
Validation: comparing an output with a known result, limit, invariant, or measurement.
Self-check
Which values are inputs, and which values must remain state?
What observable result would tell you the model is behaving as expected?
Which assumption would you test first before applying the model to a real system?
Model review: turn Numerical Differentiation and Integration into a test
Estimate velocity from position samples and position from velocity samples, then compare both with a known motion model.
Name the inputs and units that the one-dimensional motion model needs.
Separate the state you must keep from values you can calculate when needed.
Write one rule that maps the current state and inputs to an observable result.
Choose a limiting case, unit check, invariant, or known result before trusting an output.
State one assumption you would change before using this simplified model for a real decision.