In [1]:
%matplotlib inline

Springs: How do they work?

Introduction

In this investigation, we'll determine how the restoring force of a spring depends on its displacement from equilibrium.

Procedure

Data & Analysis

m (g) x (cm)
50 .6
100 1.2
150 1.9
200 2.6
250 3.3
300 4
350 4.9
400 5.6

In [39]:
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit

#------------------------------
#Write your plot/fit code below
#------------------------------
falcons = [0, 50, 100, 150, 200, 250, 300, 350, 400]
displacement = [0,.6,1.2,1.9,2.6,3.3,4,4.9,5.6]

xx = np.linspace(0,500,10)
def lin_model( x, a, b):
    return a*x + b
a,b = curve_fit(lin_model, falcons, displacement)[0]
print(a,b)
plt.title('')
plt.ylabel ('distance (cm)')
plt.xlabel ('weight (g)')
plt.plot(xx, lin_model(xx, a, b))
plt.plot(falcons,displacement,'.')


0.0140999999978 -0.142222222225
Out[39]:
[<matplotlib.lines.Line2D at 0x9199080>]
$$y=0.0140999999978x-0.142222222225$$

Results

Our experiment shows the amount of weight put on a string is proportional to how much it is displaced. We yielded an equation where the relation between weight and distance is linear, which was $y=0.014098x−0.142$.


In [ ]: