Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
restrepo
GitHub Repository: restrepo/ComputationalMethods
Path: blob/master/homework/homework_2018_1_09_1038414799.ipynb
934 views
Kernel: Python 3
%pylab inline from scipy.integrate import odeint
Populating the interactive namespace from numpy and matplotlib
yo=200 ti=0 tf=3 t=np.arange(ti,tf,0.01) def f(y, t, g=-9.8): """this is the rhs of the ODE to integrate, i.e. dy/dt=f(y,t)""" return g*t y0 = 200 # initial value a = 0 # integration limits for t b = 3 t = np.arange(a, b, 0.01) # values of t for # which we require # the solution y(t) y = odeint(f, y0, t) # actual computation of y(t) import pylab # plotting of results pylab.plot(t, y) pylab.xlabel('$t$', size=15); pylab.ylabel('$y(t)$', size=15)
<matplotlib.text.Text at 0x7f45c2b38b00>
Image in a Jupyter notebook