- numpy - matplotlib Physim

Centripetal Force Grapher

In this section you will analyze the results you observed from running the Centripetal Force Simulation by plotting the points of centripetal force versus the velocity.

Below is a graph of a the centripetal force simulation run at a radius of 16 m, and a mass of 7 kg, and how much the centripetal force changed as the velocity was changed. As you can see, the curve starts out slowly, and then the graph starts to begin an exponential curve.


If you would like to see the full code for plotting the centripetal force and velocity graph, click the Display Code button below:


# import required libraries import matplotlib.pyplot as plt import numpy as np def doafit(force, velocity, order): # initialize layout fig, ax = plt.subplots(figsize = (9,9)) # add scatterplot ax.scatter(velocity, force, s=60, alpha=0.7, edgecolors="k") params = np.polyfit(velocity, force, deg=order) ta = np.array(velocity) xseq = np.linspace(ta.min(), ta.max(), num=100) # plot regression line ff = 0. for i in range(len(params)): ff += params[i]*np.power(xseq,order- i) ax.plot(xseq, ff, color="k", lw=2.5) # axis and title plot labelling ax.set(xlabel="Velocity", ylabel="Force", title="Centripetal Force") ax.grid() return plt # velocity and force inputs force = [0.17, 1.25, 3.33, 6.43, 9.04, 12.94, 18.54, 22.83, 28.82, 36.93, 43.71] velocity = [0.6, 1.7, 2.8, 3.8, 4.5, 5.4, 6.5, 7.2, 8.1, 9.2, 10.0] deg = 2 doafit(force, velocity, deg)

Here is a code editor so that you can input your centripetal force and velocity data points based on your observations made using the Centripetal Force simulation.


This is how the centripetal force and velocity inputs should look like:

force = [0.17, 1.25, 3.33, 6.43, 9.04, 12.94, 18.54, 22.83, 28.82, 36.93, 43.71]

velocity = [0.6, 1.7, 2.8, 3.8, 4.5, 5.4, 6.5, 7.2, 8.1, 9.2, 10.0]

order = 1 means linear fit (i.e. polynomial of degree 1)

order = 2 means quadratic fit (i.e. polynomial of degree 2)

doafit is what generates a fit line or curve based on the time and height inputs.


In the centripetal force simulation, graph the force and velocity. What do you notice in the shape of the curve? is it linear? parabolic?

Do you notice any similarites or differences in your graph compared with the graph above?

Record your observations in the Centripetal Force worksheet provided in the worksheet section of the Exercises Page.


force = [] velocity = [] order = 1 doafit(force, velocity, order)


Go Back to Force Exercises Page