/vectors-and-matrices

Assignment for W2D1

Primary LanguagePython

Vector and Matrix Math

Description

Implement various vector and matrix math functions using no math libraries.

Objectives

Learning Objectives

After completing this assignment, you should understand:

  • List comprehensions
  • Introductory linear algebra concepts
  • Raising exceptions

Performance Objectives

After completing this assignment, you should be able to:

  • Perform mathematical operations on complex list structures

Details

Deliverables

  • A Git repo called vectors-and-matrices containing at least:
    • README.md file explaining how to run your project
    • a module called matrix_math
    • tests for matrix_math

Requirements

  • Passing unit tests
  • No PEP8 or Pyflakes warnings or errors
  • No use of third-party libraries - only built in + - / * operators and the math module
  • No use of for or while loops

Normal Mode

Implement these linear algebra functions:

  • vector addition and subtraction
  • vector multiplication by a scalar
  • mean of multiple vectors
  • dot product
  • magnitude
  • matrix addition and subtraction
  • matrix multiplication by a scalar
  • matrix multiplication by a vector
  • matrix multiplication by a matrix

These functions are all defined in the formulas notebook included with this assignment as well as the tests.

These functions must:

  • Check the shape of the incoming vector or matrix before any calculations
  • Reuse any duplicated code

Reading