Economics Dynamics Problems 212

Economics Dynamics Problems 212 - x[t:=solx y[t:=soly...

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

View Full Document Right Arrow Icon
196 Economic Dynamics Notice that we have placed a semi-colon after the ‘sol’ instruction so that you can observe that Maple produces a procedural output, which is then used in the odeplot. If the equations for x ( t ) and y ( t ) are already known, then the plot command can be used. For example, if it is known that x ( t ) = 2 e 2 t and y ( t ) = 3 e t then all that is required is plot([2*exp(2*t),3*exp(t),t=0. .1],labels=[x,y]); 4A.2 Three-variable case Plotting trajectories in 3-dimensional phase space is fundamentally the same, with just a few changes to the commands used. Equation (4.36) with Mathematica The input instructions are Clear[x,y,z] sol=DSolve[{x’[t]==x[t],y’[t]==x[t]+3y[t]-z[t], z[t]==2y[t]+3x[t],x[0]==1,y[0]==1,z[0]==2}, {x[t],y[t],z[t]},t] solx=sol[[1,1,2]] soly=sol[[1,2,2]] solz=sol[[1,3,2]]
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x[t-]:=solx y[t-]:=soly z[t-]:=solz traj=ParametricPlot3D[{x[t],y[t],z[t]},{t,0,5}] If the equations for x ( t ) , y ( t ) and z ( t ) are already known, then only the last instruc-tion need be given. For example, if it is known that x ( t ) = e t , y ( t ) = 2 e t − e 2 t + 2 te t and z ( t ) = 4 te t − e 2 t + 3 e t then all that is required is traj=ParametricPlot3D[{e t ,2e t-e 2t +2te t ,4te t-e 2t +3e t }, {t,0,5}] Equation (4.36) with Maple The input instructions are restart; with(plots): sys:={diff(x(t),t)=x(t),diff(y(t),t)=x(t)+3*y(t)-z(t), diff(z(t),t)=2*y(t)+3*x(t),x(0)=1,y(0)=1,z(0)=2}; vars:={x(t),y(t),z(t)}: sol:=dsolve(sys,vars,numeric); odeplot(sol,[x(t),y(t),z(t)],0. .5,labels=[x,y,z]);...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online