Vectors

Vectors#

Note

Source: Python-specific — no equivalent in the C# edition.

Todo

Write the vectors section covering:

  • A vector as an ordered list of numbers; representation as a Python list

  • Element-wise addition and subtraction

  • Scalar multiplication

  • Dot product: definition, implementation with a loop, geometric meaning

  • Magnitude (Euclidean norm): math.sqrt(sum(x**2 for x in v))

  • Normalization: dividing each element by the magnitude

  • Code examples for each operation as standalone functions

  • Sample runs showing input/output

  • Brief note on how these map directly to numpy array operations

  • Review questions / exercises