Skip to content

Commit ebb4ebd

Browse files
committed
imported g form scipy and changed doctests accordingly
1 parent 6eb3556 commit ebb4ebd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: physics/time_period_simple_pendulum.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@
3030
3131
Reference : https://byjus.com/jee/simple-pendulum/
3232
"""
33-
33+
from scipy.constants import g
3434

3535
def time_period_simple_pendulum(length: float) -> float:
3636
"""
3737
>>> time_period_simple_pendulum(1.23)
38-
2.2259685262423705
38+
2.2252136710666166
3939
>>> time_period_simple_pendulum(2.37)
40-
3.089873051721361
40+
3.088825235169592
4141
>>> time_period_simple_pendulum(5.63)
42-
4.762342885477521
42+
4.760727912429414
4343
>>> time_period_simple_pendulum(-12)
4444
Traceback (most recent call last):
4545
...
@@ -49,7 +49,7 @@ def time_period_simple_pendulum(length: float) -> float:
4949
"""
5050
if length < 0:
5151
raise ValueError("The length should be non-negative")
52-
return (2 * 3.14159) * (length / 9.8) ** 0.5
52+
return (2 * 3.14159) * (length / g) ** 0.5
5353

5454

5555
if __name__ == "__main__":

0 commit comments

Comments
 (0)