Lab 2 NumPy creates two 100 x 100 arrays


Rate this product

Lab 2
The purpose of this lab is to get you familiar with Python and Jupyter Notebook.
 Write a program that uses NumPy creates two 100 x 100 arrays, then adds them together
in two different ways: first by using a double for loop, and then by using the ‘+’ operator.
Time how long each method takes to add the matrices. Use the “time” module.
 Time each method 1000 times and record the timing results in a vector of length 1000
For each method:
o Print the average and standard deviation of the running time
o Plot a histogram of the running times
 Write a small example program of your own choosing in Jupyter Notebook. Clearly
describe in the comments what the program is supposed to do, and make sure we can run
Useful resources on Python:
 Google’s Python class
 The SciPy Lecture Notes
 Stanford Python Numpy Tutorial

Scroll to Top