In this homework, well write a program to calculate the capacity dimension of a trajectory of a dynamical system For simplicity, for this video, well focus on the two-dimensional case But later, in the more advanced version of the homework, youll work in the n-dimensional case The first step in this process is to write a program to calculate the number of boxes needed, of side length epsilon, needed to cover an object To do this, well cover the object with a grid These are the grey dots you see in the right picture Each one of these squares is epsilon by epsilon wide In your code, you dont actually want to build this grid every time The grid is simply there as a visual for understanding this algorithm What we want to do is have a matrix, where each index in the matrix is mapped to one element in this grid So for example, the grid element in the upper left would be mapped to the matrix element (1, 1) This chunk of code sets up such a matrix We then simply need to walk over the trajectory, and map each element in the trajectory to one of these positions in the matrix, and then activate that element in the matrix In the video youll see new black stars appearing Each black star corresponds to the next point in the trajectory We will then use this map, which takes the current element minus the minimum in that direction, divided by epsilon, and takes the ceiling of that Thatll map that element of the trajectory to an index in the matrix We then simply need to activate that element in the matrix That is, we simply need to set the entry in the matrix at that index equal to one In the video, this is shown as the grayed-out boxes being activated by red So just for visual mapping, the black stars are being mapped by this mapping to a position in the box matrix And then the entry at that index in the matrix is being set equal to one, and this is equivalent to the red boxes appearing Once weve gone through the entire trajectory, well see something like this Here, the trajectory has been covered by the minimum number of boxes of that size epsilon needed In the matrix notation, you have a matrix where each one of these red boxes is represented by a one, and each one of the grayed-out boxes is represented by a zero If we then just sum up all the entries of the matrix  thats this line here  well get the number of boxes needed, of that size epsilon, to cover the trajectory This is precisely the function you needed for part 1 of the homework With the function I just showed you, you can now answer questions a through d If you run this code using an epsilon of 0.05, using an x, z projection of the trajectory located at the link in this homework, you get that it takes 13,968 boxes Part b asks, would this point  that is, log(1/epsilon) over log(N(epsilon))  be in the scaling region of a log(N(epsilon)) versus log(1/epsilon) plot for this trajectory And the answer to this is no: all points are covered by approximately their own box If you look at the length of this time series, or the length of this trajectory, its 14,000 points long The fact that theres 13,968 boxes means that basically every point has its own box Most likely this point would be on the top, flat curve, not in the scaling region For part c, we instead use an epsilon of 0.5 In this case, we get that we have 4,342 boxes Part d asks the same thing as part b, but instead, epsilon is 0.5 Since we had 14,000 points in the trajectory, and we had 4,342 boxes, its most likely the case that this point would be in the scaling region Certainly, all points are not covered by a single box Theyre covered by 4,342 boxes And, not all points are covered by approximately their own box Many boxes are shared So its likely that this point would be in the scaling region However, to show that this is true, you would need to do this calculation for a range of epsilon, and plot log(N(epsilon)) versus log(1/epsilon), and check for a scaling region by hand