Skip to content

Commit edf8f34

Browse files
authored
Update hookes_law.py
1 parent 0604529 commit edf8f34

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

physics/hookes_law.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,19 @@
33
Hookes Law states that the Force is directly proportional to the extension
44
or compression of an elastic object, provided the limit of proportionality
55
is not exceeded.
6-
76
Formulae : F = -k*x
8-
97
F: Force
108
k: Spring constant
119
x: displacement from the equilibrium position
12-
1310
The negative sign indicates that the restoring force acts in the opposite
1411
direction to the displacement, always working to bring the object back to
1512
its original state.
16-
1713
Reference: https://en.wikipedia.org/wiki/Hooke%27s_law
18-
1914
"""
20-
21-
2215
def 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-
3727
if __name__ == "__main__":
3828
import doctest
3929

0 commit comments

Comments
 (0)