Created
February 21, 2021 13:19
-
-
Save Dabsunter/83d1cc46b5ac88dd935ffbc66f394109 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# marche que pour le 2nd ordre | |
def euler2(F, a,b, y0, yp0, n): | |
h = (b-a)/n | |
T = np.linspace(a,b,n+1) | |
Yp = np.zeros(n+1) | |
Y = np.zeros(n+1) | |
Y[0] = y0 | |
Yp[0] = yp0 | |
for i in range(n): | |
Y[i+1] = Y[i] + h*Yp[i] | |
Yp[i+1] = Yp[i] + h*F(Y[i], Yp[i], T[i]) | |
return Y,Yp,T | |
def euleryoussranicolazo(F,a,b,y0,h): | |
Y = [y0] | |
T = [a] | |
t = a; | |
while t < b: | |
y = Y[-1] + h*F(Y[-1], t) | |
t += h | |
Y.append(y) | |
T.append(t) | |
return Y,T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment