Economics Dynamics Problems 93

Economics Dynamics Problems 93 - dy dx = 2 x y the...

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

View Full Document Right Arrow Icon
Continuous dynamic systems 77 the instruction for solving this is Sol1=dsolve({diff(y(t),t)=sin(3*t-y(t)),y(0)=0.5}, y(t),numeric); Although the output is named ‘Sol’, the solution is still for the variable y ( t ). So the plot would involve the input odeplot(Sol1,[t,y(t)],0. .10); Note that the range for t is given only in the odeplot instruction. Higher-order ordinary differential equations are treated in the same way. For example, given the initial value problem, d 2 y dt 2 + 0 . 5 dy dt + sin( y ) = 0 , y (0) =− 1 , y ± (0) = 0 , t [0,15] the input instruction is Sol2=dsolve({diff(y(t),t$2)+0.5*diff(y(t), t)+sin(y(t))=0, y(0)=-1,D(y)(0)=0},y(t),numeric); with plot odeplot(Sol2,[t,y(t)],0. .15); Appendix2.1PlottingdirectionfeldsForasingleequation with Mathematica ±igure 2.8 (p. 45) Given the differential equation
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: dy dx = 2 x y the direction eld and isoclines can be obtained using Mathematica as follows: Step 1 Load the Plotield subroutine with the instruction << Graphics`PlotField` Note the use of the back-sloped apostrophe. Step 2 Obtain the direction eld by using the PlotVectorield command as follows arrows=PlotVectorField[{1,2x-y},{x,-2,2},{y,-2,2}] Note the following: (a) arrows is a name (with lower case a) which will be used later in the routine (b) the rst element in the rst bracket is unity, which represents the time derivative with respect to itself (c) if memory is scarce, the plot can be suppressed by inserting a semi-colon at the end of the line....
View Full Document

Ask a homework question - tutors are online