Homework 8

Send your homework as a single ZIP archive with your files, or send a link to your GitHub repo. Try to keep line lengths below 80 characters.

EXERCISE 8.1

Create the following NumPy arrays:
(a) float from 0.0 to 1.0 step 0.1, shape=(11,),
(b) int zeros (1 byte) with shape=(5,6),
(c) complex with shape=(9,), powers of x = complex(0, 1): 1, x, x**2, ..., x**8.

EXERCISE 8.2

(a) Create an arbitrary one dimensional array called v1.
(b) Create a new array (or a view) v2 which consists of items with odd indices of v1.
(c) Create a new array (or a view) v3 in backwards ordering from v1.

EXERCISE 8.3

(a) Create a two dimensional array called m1, shape=(4,5).
(b) Create a new array (or a view) m2 from m1, in which the elements of each row are in reverse order.
(c) Create a new array (or a view) m3 from m1, in which the elements of each column are in reverse order.
(d) Remove the first row, the last row, the first column, and the last column of m1, and create a new array (or a view) m4.