1. Problem set 1
You can think of vectors representing many dimensions of related information. For instance, Netﬂix might store all the ratings a user gives to movies in a vector. This is clearly a vector of very large dimensions (in the millions) and very sparse as the user might have rated only a few movies. Similarly, Amazon might store the items purchased by a user in a vector, with each slot or dimension representing a unique product and the value of the slot, the number of such items the user bought. One task that is frequently done in these settings is to ﬁnd similarities between users. And, we can use dot-product between vectors to do just that. As you know, the dot-product is proportional to the length of two vectors and to the angle between them. In fact, the dot-product between two vectors, normalized by their lengths is called as the cosine distance and is frequently used in recommendation engines. (1) Calculate the dot product u.v where u = [0.5;0.5] and v = [3;−4] (2) What are the lengths of u and v? (3) What is the linear combination: 3u−2v? (4) What is the angle between u and v You can use R-markdown to submit your responses to this problem set. If you decide to do it in paper, then please either scan it or take a picture using a smartphone and attach that picture. Please make sure that the picture is legible before submitting.
2. Problem set 2
Set up a system of equations with 3 variables and 3 constraints and solve for x. Please write a function in Octave that will take two variables (matrix A & constraint vector b) and solve using elimination. Your function should produce the right answer for the system of equations for any 3-variable, 3-equation system. You don’t have to worry about degenerate cases and can safely assume that the function will only be tested with a system of equations that has a solution. Please note that you do have to worry about zero pivots, though. Please test it with the system below and it should produce a solution x = [−1.55,−0.33,0.95] 1 1 3 2 −1 5 −1 −2 4 x1 x2 x3 = 1 2 6
ASSIGNMENT 1-FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS
1. Problem set 1