File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33Hookes Law states that the Force is directly proportional to the extension
44or compression of an elastic object, provided the limit of proportionality
55is not exceeded.
6-
76Formulae : F = -k*x
8-
97F: Force
108k: Spring constant
119x: displacement from the equilibrium position
12-
1310The negative sign indicates that the restoring force acts in the opposite
1411direction to the displacement, always working to bring the object back to
1512its original state.
16-
1713Reference: https://en.wikipedia.org/wiki/Hooke%27s_law
18-
1914"""
20-
21-
2215def hookes_law (k : float , x : float ) -> float :
2316 """
2417 Calculate the Hookes law from the given values of spring constant 'k'
2518 and the displacement 'x' from the equilibrium position.
26-
2719 >>> hookes_law(200, 0.05)
2820 -10.0
2921 >>> hookes_law(50, 5)
@@ -32,8 +24,6 @@ def hookes_law(k: float, x: float) -> float:
3224 -900
3325 """
3426 return round (- k * x , 2 )
35-
36-
3727if __name__ == "__main__" :
3828 import doctest
3929
You can’t perform that action at this time.
0 commit comments