-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Einstein's Energy-Mass Equivalence #9191 #9220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5d1f7ce
54f58b2
e32865b
03023a6
029f226
4fc0e09
b1f9122
6f86277
e5b16ea
9b39693
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
c = 299792458 | ||
|
||
|
||
def energy_equivalence(mass_kg): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As there is no test file in this pull request nor any test function or class in the file Please provide return type hint for the function: Please provide type hint for the parameter: |
||
# Check if the mass is non-negative | ||
if mass < 0: | ||
raise ValueError("mass should be positive") | ||
|
||
# Check if the speed of light is positive | ||
if c <= 0: | ||
raise ValueError("Speed of light must be positive") | ||
|
||
# Calculate energy using the mass-energy equivalence equation | ||
energy = mass * c**2 | ||
return energy | ||
|
||
|
||
if __name__ == "__main__": | ||
energy_equivalence() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As there is no test file in this pull request nor any test function or class in the file
physics/Einstein's Energy-Mass Equivalence.py
, please provide doctest for the functionenergy_equivalence
Please provide return type hint for the function:
energy_equivalence
. If the function does not return a value, please provide the type hint as:def function() -> None:
Please provide type hint for the parameter:
mass_kg