-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8816f67
commit 09217af
Showing
4 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import random | ||
import time | ||
|
||
|
||
# Start timer | ||
startTimer = time.perf_counter() | ||
startTimer2 = time.process_time() | ||
|
||
def waveFunc(loopNum): | ||
for loop in range(loopNum): | ||
# Get the mass, Planck's Constant, and etc... | ||
mass = random.randint(1, 500) | ||
v = random.randint(1, 500) | ||
x = random.randint(1, 500) | ||
t = random.randint(1, 360) | ||
i = int(0 + (-1 * 0.5)) | ||
|
||
h = float(6.63) | ||
|
||
# Kentic and Potential engeries | ||
KE = float((-h ** 2 / 2 * mass) * v ** 2) | ||
PE = int(v * (x + t)) | ||
|
||
# Add KE + PE | ||
step1 = float(KE + PE) | ||
|
||
step2 = float((i * h) * (2 / 2 * t)) | ||
|
||
# Get the final value | ||
print(f"SE: {step1 - step2}\n") | ||
|
||
# Run the function with a specific amount of times it will have to repeat the loop | ||
waveFunc(None) | ||
|
||
endTimer = time.perf_counter() | ||
endTimer2 = time.process_time() | ||
|
||
print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters