A vector describes both an amount and a direction. In code, its components are a small structured value; in a diagram, the same value is an arrow.
Think like a programmer
An array-like vector is data in a chosen coordinate basis. Do not confuse the stored components with the physical object: rotate the basis and the components can change while the arrow in space does not.
Model checklist
Inputs
x and y components in a stated basis.
State
A two-component vector.
Rule
Use component arithmetic for addition and scaling.
Output
An arrow and its magnitude.
Check
The magnitude is non-negative and equals zero only for [0, 0].
\[|\\mathbf{v}|=\\sqrt{v_x^2+v_y^2}\]
Loading the interactive visual. The lesson text and model remain available while it starts.
Prediction: Changing the sign of x reflects the arrow across the vertical axis without changing its magnitude.
Set x to 3 and then -3 while leaving y unchanged. Compare the text value with the arrow.
Where this model breaks
Components need a declared basis and units. A plain [3, 2] does not tell you whether it is metres, metres per second, or values from two incompatible coordinate frames.
Summary
Store vectors as named components, keep their basis and units clear, and derive magnitude with a testable pure function.
Glossary
Component: one coordinate of a vector in a chosen basis.
Magnitude: the non-negative length of a vector.
Basis: the reference directions used to express components.
Self-check
What happens to magnitude when x changes sign?
Why are units still needed with vector components?
What does the zero vector mean?
Sources
OpenStax, University Physics Volume 1, vectors chapter.
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 Vectors as Arrays, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Vectors and Coordinate Systems, 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 Vectors as Arrays 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 Vectors as Arrays into a test
Represent a two-dimensional vector as components, draw it as an arrow, and test its magnitude with code.
Name the inputs and units that the vectors and coordinate systems 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.