Question: Look at the code in the next two cells. It imports matplotlib and numpy in the first, then generates a plot of four different functions

Look at the code in the next two cells. It imports matplotlib and numpy in the first, then generates a plot of four different functions in the second. The scale of the plot is specified on the first line as 0 to 10 with 100 random points generated. The scale can be adjusted above 10 for a wider/larger scale, or less than 10 for a smaller scale.

import matplotlib.pyplot as plt import numpy as np n = np.linspace(0, 10, 100) # generate 100 sample points in range 1 to 10 - change the 10 to a different scale # Generate lines on the graph plt.plot(n, 8*n, label = '8n: linear') # graph a linear function plt.plot(n, 2*n**2, label = '2n**2: quadratic') # graph a quadratic function plt.plot(n, n**3, label = 'n**3: cubic') # graph a cubic function plt.plot(n, 2**n, label = '2**n: exponential') # graph an exponential function # Labels plt.title('textrbook: R3.1 - comparison plot of various growth functions') plt.legend() # Do it! plt.show()

Look at the code in the next two cells. It imports matplotlib

1. What differences do you see in the generated functions compared with the first one whose scale only went to 10? (graph for scale 10)

and numpy in the first, then generates a plot of four different

2. change the scale to 20, then rerun. What differences do you see in the generated functions compared with the first two above?

functions in the second. The scale of the plot is specified on

3. change the scale to 3, then rerun. What differences do you see in the generated functions compared with the ones above?

the first line as 0 to 10 with 100 random points generated.

tentrknnlon n T toythnok- R 1 - romnaricon nlnt of varinuc arnuth functinne aph showing smaller scale/lower volume texthnnk-R? 1 - romnaricon nlnt of varins aromth fnctinne textbook: R3.1 - comnarison vlot of various arowth functions

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!