Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Output graph of a simple harmonic oscillator | |
import numpy as np | |
import matplotlib.pyplot as plot | |
def x(A, omega_0, phi_0, t): | |
return A * np.cos(omega_0*t + phi_0) | |
x_0, v_0 = 5.0, 15.0 | |
m, c = 0.5, 0.8 |
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
# Output graph of a weakly damped harmonic oscillator | |
import numpy as np | |
import matplotlib.pyplot as plot | |
def x(A_0, gamma, omega_d, phi_0, t): | |
return A_0 * np.exp(-gamma*t) * np.cos(omega_d*t + phi_0) | |
def exp(A_0, gamma, t): | |
return A_0 * np.exp(-gamma*t) |
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
function foo(param, callback){ | |
setTimeout(()=>{ | |
var res = some_blocking_function() | |
callback(res) | |
}, 0) | |
} | |
function foo2(param, callback){ | |
if(param_is_wrong) callback("Wrong Parameter", -1) | |
else{ |