Last Updated 10/21/2022

Sage Essentials
Section 7: Matrix Manipulations

Matrix Multiplications

Example 3

Compute the product of the matrix  A=[ 1 0 1 1 ] and vector v=[ 20 10 ] .

 

To define the vector v, we use the vector command. We use the “*” operator to compute Av.

 

Note that in the context of matrix-vector multiplication, the vectors defined this way are considered as both column and row vectors.  SageMath automatically chooses the correct interpretation that results in valid multiplications.

Try this!

What happens if we try to compute vA for A and v as defined above?


← Previous Example Next Example →