Exercise 11.3

Exercise 11.3#

Question 1#

Consider the matrix:

(12345678910111213141516)

Enter this matrix into your script and preform the following tasks:

  1. Extract the second column.

  2. Extract the central 2×2 block.

  3. Find the transpose of the matrix.

Question 2#

Consider the matrix equation: Ax=B, where A and B are known matrices and x is an unknown matrix. Write a program which solves this equation for x, assuming A is a square matrix. Test it with the following example:

A=(2683) and B=(73) which gives x=(0.07141.1905)

Bonus: Can you write a program which solves this for non-square matrices? (see numpy.linalg.lstsq).

Test it on the following example:

A=(5.34.22.93.42.712.1) and B=(7.41.7) which gives x=(0.95800.75870.2980)