9. Exercise Set 3

Exercise 3.1: Dot Products

Given: two vectors, x and y, of equal size and range;
Compose: a loop that returns their dot (or inner) product.
Click here for a sample answer.

Exercise 3.2: Vector Max and Min

Given: two vectors, x and y, of equal size and range;
Compose: a loop that returns two vectors, containing the larger and smaller elements, respectively, of each position in the two vectors.
Click here for a sample answer.

Exercise 3.3: Vector Sum and Difference

Given: two vectors, x, and y, of equal size and range;
Compose: a loop that returns four vectors, containing, respectively, the element-wise sum and difference of the two vectors, and the sums of the elements in each of the two vectors.
Click here for a sample answer.




Previous Section



Next Section



Table of Contents