Skip to content

# Review Questions

## Review Questions

#### Array Creation

Q09.01 Create an array of the numbers 1, 5, 19, 30

Q09.02 Create an array of the numbers -3, 15, 0.001, 6.02e23\$

Q09.03 Create an array of integers between -10 and 10

Q09.04 Create an array of 10 angles between 0 and 2$\pi$

Q09.05 Create an array of logarithmically spaced numbers between 1 and 1 million

Q09.06 Create an array of 20 random integers between 1 and 10

Q09.07 Create an array of 30 random numbers with a normal distribution

Q09.08 Create an array of 30 random numbers with a normal distribution that has an mean $\mu$ of 78.5 and a standard deviation $\sigma$ of 5.2

Q09.09 Create an array of 18 random floating point numbers between 0 and 1

Q09.09 Create an array of 18 random floating point numbers between -1 and 0

Q09.09 Create an array of 18 random floating point numbers between 0 and 10

#### Meshgrids

Q09.40 Create two 2D arrays from the two 1D arrays below using NumPy's np.meshgrid() function.


x = [0.0, 0.1., 0.2, 0.3, 0.4, 0.5]

y = [0, 2, 4, 6]


Q09.41 Create a meshgrid of the two arrays below:


x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


Use element-wise multiplication to multiple each element in one of the resulting 2D arrays with the other resulting 2D array to build a multiplication table.

#### Array Operations

Q09.50 Create the two arrays below and perform each calculation.

a = [2 4 6]

b = [-1 0 1]

(a) $a + b$

(b) $1.5a -2b$

(c) $0.5ab$

(d) $\frac{b^2}{a}$

Q09.51 Create an array of angles between 0 and 2$\pi$ radians in increments of $\pi/2 radians$.

(a) Calculate the sine of each angle in the array

(b) Calculate the cosine of each angle in the array

(c) Convert each angle in the array to degrees

Q09.52 Create the two arrays below and then perform the following operations.

F1 = [-1, 0, 2]

F2 = [5, -2, 0]

(a) Calculate the dot product of F1 and F2

(b) Calculate cross product of F1 and F2

(c) Calculate the element-wise product (element-wise multiplication of F1 and F2)

#### Linear Algebra

Q09.70 Use the system of linear equations below to calculate the values of $x$ and $y$.

4x - 2y = -42
-6x + y = 31

Q09.70 Use the system of linear equations below to calculate the values of $x$, $y$ and $z$.

\frac{x}{2} +2y - z = 5
x + 3y - 4z = -1
-x - 3y + 2z = -5