``````

In [2]:

%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

In this experiment, we measured the displacement of the spring in relation to the mass applied to it. We used a spring weight to determine how far a certain weight traveled from one exact point which was 0. The given weights were 50g, 100g, 150g, 200g, and a 250g. We placed the weight, observed how far it traveled, and then tried to stabilize the spring as much as we can so we would be able to obtain accurate and precise measurements. After we found how much each weight traveled on the spring, we recorded our data on a Data & Analysis table and then placed a line of best fit onto the graph.

### Data & Analysis

m (g) x (cm)
50 1.9
100 3.75
150 5.7
200 7.7
250 9.7
``````

In [15]:

import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
x = [50, 100, 150, 200, 250]
y = [1.9, 3.75, 5.7, 7.7, 9.7]
def line(x, a, b):
return(a*x + b)
a,b = curve_fit(line, x, y)[0]
print(a, b)
plt.xlabel('Weight(g)')
plt.ylabel('Distance(cm)')
plt.title('Spring Displacement')
plt.plot(x, y, 'ko')
xx = np.linspace(0, 300, 15)
plt.plot(xx, line(xx, a, b))
plt.xlim(0,300)
plt.ylim(-1,15)
plt.show()

``````
``````

0.0390999999979 -0.115000000002

``````

### Results

After plotting the points, we were able to find an equation for a linear function, \$y=0.039x - 0.115\$. The \$a\$ value we gained was rounded to \$0.039\$ aand our \$b\$ value was \$-0.115\$. We then tested our equation with a given displacement, \$y\$, and we found that it was mostly accurate. The value we received was about 138g, which was somewhat close to the actual weight, 120g.

### Conclusion

We concluded that as the weight applied to the spring increased, the displacement it traveled from its origin to where it rested was increasing as well. The resulted value for \$a\$ is the constant force of gravity applied to the spring and the value for \$b\$ is the restoring force of the spring applied to the mass in the opposing direction. We also discovered that even though 0 weight is applied, the \$b\$ value is still negative. As you can see in the equation \$y = 0.039(0) - 0.115\$, \$y\$ would be \$-0.115\$. The distance should be \$0\$ because no weight is applied, but we ended up with a negative value which doesn't make sense.