Question: Numpy and Matplotlib are allowed. 1.Create two arrays X and Y as NumPy arrays. X=[1,2,3,4,5,6,7,8,9,10] Y= [1,2,3,4,5,6,7,8,9,10] 2. Define a variable Z = (X-5)2 +

 Numpy and Matplotlib are allowed. 1.Create two arrays X and Y

Numpy and Matplotlib are allowed. 1.Create two arrays X and Y as NumPy arrays. X=[1,2,3,4,5,6,7,8,9,10] Y= [1,2,3,4,5,6,7,8,9,10] 2. Define a variable Z = (X-5)2 + (Y-5)2 3. Plot the contour figure of Z. (Plot the value of Z using different colors at each possible (X,Y) location.) Your figure should look similar to this. Mark the X and Y axis and mark out the Z's minimum value on the figure. hint: https://matplotlib.org/3.1.1/api/ as gen/matplotlib.pyplot.contour.html 10 8 Y 2 CO - 10 hint/sample code for contour plot: import matplotlib.pyplot as plt plt.contourf(Xaxis, Yaxis,Z, 20, alpha=0.5, cmap = plt.get_cmap('jet')) plt.plot([5], [5], 'o', ms=12, markeredgewidth=3, color="orange") plt.xlim(0,10) plt.ylim(0,10) plt.xlabel(r'$X$',fontsize=16) plt.ylabel(r'$y$,fontsize=16) plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!