DNDS6013 Scientific Python, Winter 2019/2020
Homework 1, Due: Thursday February 20th, 3:30pm
Instructions: complete the selection of exercises from the class notebooks. Use markdown cells between code examples to explain.
Questions¶
Use file “Hun_cities.csv” from class which contains a list of Hungarian cities.
1. Using the binning method explained in class, write a function create_grid(cities, N) that places cities in an NxN grid and returns the grid.
2. Using the binning method, write a function gridmax(cities, N) that computes the maximum distance between cities using an NxN square grid.
3. Using the binning method, write a function gridmin(cities, N) that computes the minimum distance between cities using an NxN square grid.
4. For both 1 and 2, find the value of N that minimizes the time required to perform each computation.
In [ ]: