Economics Dynamics Problems 89

Economics Dynamics Problems 89 - NDSolve command....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Continuous dynamic systems 73 the independent variable. Given the following initial value problem dy dt = f ( y ( t ) , t ) y (0) = y 0 the input instruction is NDSolve[{y’[t]==f[y[t],t],y[0]==y0}, y[t],{t,tmin,tmax}] Mathematica provides output in the form of an InterpolatingFunction that rep- resents an approximate function obtained using interpolation. This Interpolating- Function can then be plotted. Since it is usual to plot an InterpolatingFunction, then it is useful to give the output a name. For example, given the problem dy dt = sin(3 t y ) y (0) = 0 . 5 , t [0 , 10] the instruction is sol=NDSolve[{y’[t]==Sin[3t-y[t]],y[0]==0.5}, y[t],{t,0,10}] Although the output is named ‘sol’, the solution is still for the variable y ( t ). So the plot would involve the input Plot[y[t] /. sol, {t,0,10}] Note that the range for t in the plot is identical to the range given in the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: NDSolve command. Higher-order ordinary differential equations are treated in the same way. For example, given the initial value problem d 2 y dt 2 + . 5 dy dt + sin( y ) = , y (0) = 1 , y (0) = , t [0 , 15] the input instruction is sol=NDSolve[{y[t]+0.5y[t]+Sin[y[t]]==0, y[0]==-1,y[0]==0}, y[t],{t,0,15}] with plot Plot[y[t] /. sol, {t,0,15}] 2.12 Solving differential equations with Maple 2.12.1 First-order equations Maple has a built in command for dealing with differential equations, which is the dsolve command. This command is used to nd a symbolic solution to a differential equation. The command dsolve(. . . , numeric) nds a numerical approximation. Consider the following rst-order differential equation dy dt = f ( y , t )...
View Full Document

This note was uploaded on 12/14/2011 for the course ECO 3023 taught by Professor Dr.gwartney during the Fall '11 term at FSU.

Ask a homework question - tutors are online