Skip to content

Instantly share code, notes, and snippets.

View mirianfsilva's full-sized avatar

Mírian Silva mirianfsilva

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mirianfsilva
mirianfsilva / finitedifferences.ipynb
Last active October 14, 2020 15:54
FiniteDifferences.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mirianfsilva
mirianfsilva / finitedifferences_withoutplots.ipynb
Last active October 14, 2020 15:55
FiniteDifferences_withoutplot.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mirianfsilva
mirianfsilva / FiniteDifferenceMethods.ipynb
Last active October 14, 2020 15:55
The Heat (or diffusion) Parabolic PDE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mirianfsilva
mirianfsilva / ODE-Euler.py
Created December 2, 2018 23:50
Method to find solution of ordinary differential equations
import math, sys
import numpy as np
def Euler(f, y0, T, n):
"""Solve y’= f(y,t), y(0)=y0, with n steps until t=T."""
t = np.zeros(n+1)
y = np.zeros(n+1) # y[k] is the solution at time t[k]
y[0] = y0
t[0] = 0
dt = T/float(n)
@mirianfsilva
mirianfsilva / ODE-ForwardEuler.py
Last active December 2, 2018 23:51
Method to find solution of ordinary differential equations
#Forward Euler
import math, sys
import numpy as np
def ForwardEuler(f, y0, T, n):
"""Solve y’= f(y,t), y(0)=y0, with n steps until t=T."""
t = np.zeros(n+1)
y = np.zeros(n+1) # y[k] is the solution at time t[k]
y[0] = y0
t[0] = 0
@mirianfsilva
mirianfsilva / ODE-Heun.py
Last active December 2, 2018 23:51
Method to find solution of ordinary differential equations
#Heun Method for solutions approach
import math, sys
import numpy as np
def Heun(f, y0, T, n):
"""Solve y'=f(t,y), y(0)=y0, with n steps until t=T."""
t = np.zeros(n+1)
y = np.zeros(n+1) # y[k] is the solution at time t[k]
dt = T/float(n)
y[0] = y0
@mirianfsilva
mirianfsilva / ODE-Midpoint.py
Last active December 2, 2018 23:52
Method to find solution of ordinary differential equations
#Midpoint Method for solutions approach
import math, sys
import numpy as np
def Midpoint(f, y0, T, n):
"""Solve y'=f(t,y), y(0)=y0, with n steps until t=T."""
dt = T/float(n)
t = np.zeros(n+1)
y = np.zeros(n+1) # y[k] is the solution at time t[k]
y[0] = y0