CompSciHW8
From Predictive Chemistry
Revision as of 09:41, 4 April 2016 by David M. Rogers (talk | contribs) (Created page with "Introduction to Scientific Computing, Homework 8. Due Friday, April 8 2016. <pre> 1) Write code to generate the following empty arrays: a) a vector of 100 floats b) a 20 ...")
Introduction to Scientific Computing, Homework 8. Due Friday, April 8 2016.
1) Write code to generate the following empty arrays: a) a vector of 100 floats b) a 20 x 3 matrix of integers c) a 2 x 5 x 5 array of floats d) a 5 x 5 matrix taken from the first group of (c) 2) Write code to carry out matrix multiplication manually and test it against the result of numpy.dot. 3) Write code to multiply every column of matrix, A, with every other column. Use this to find the set of angles between the column vectors. 4) Generate 2 random 3D vectors, using numpy.random.random(3). Compute the cosine between the two vectors. Now run this 1000 times, and plot a histogram of the cosine. note: plt.histogram(list_of_cosine_values) will automatically create the histogram from your list (length 1000) list of cosines. 5) Generate 2 random 3D vectors using the method above, and compute the distance between them. Run this 1000 times, and plot a histogram of the distance values. What do you notice about the shape of the distribution? Does it have a maximum? Does this correspond to your geometrical intuition?