with(plots): #defining these saves typing later fxns:={y1(t),y2(t)}; #these are the equations sys:=D(y1)(t)=y2(t), D(y2)(t)=-y2(t)/2+cos(2*y1(t)); #trajectories starting on the positive y2 axis for i from 1 to 14 do p[i]:=dsolve({sys,y1(0)=0,y2(0)=i*Pi/7},fxns,type=numeric): pl[i]:=odeplot(p[i], [y1(t),y2(t)],0...15, numpoints=250,view=[0...6,-3...3]): od: #so the way it works is, the p[i] is defined to be the numerical solution of the differential equations with the initial data given in the curly brackets, the pl[i] is then defined as the odeplot of this. the do loop runs through various initial data, the numpoints gives the number of points used by the numerics #trajectories starting on the negative y2 axis for i from 1 to 14 do q[i]:=dsolve({sys,y1(0)=2*Pi,y2(0)=-i*Pi/7},fxns,type=numeric): ql[i]:=odeplot(q[i], [y1(t),y2(t)],0...15, numpoints=150,view=[0...6,-3...3]): od: #trajectories starting at the first saddle point s:=dsolve({sys,y1(0)=3*Pi/4-.01,y2(0)=0},fxns,type=numeric): sl1:=odeplot(s, [y1(t),y2(t)],0...12, numpoints=100,view=[0...6,-3...3]): sl2:=odeplot(s, [y1(t),y2(t)],-12...0, numpoints=100,view=[0...6,-3...3]): z:=dsolve({sys,y1(0)=3*Pi/4+.01,y2(0)=0},fxns,type=numeric): sl3:=odeplot(z, [y1(t),y2(t)],0...12, numpoints=100,view=[0...6,-3...3]): sl4:=odeplot(z, [y1(t),y2(t)],-12...0, numpoints=100,view=[0...6,-3...3]): #trajectories starting at the second saddle point t:=dsolve({sys,y1(0)=7*Pi/4-.01,y2(0)=0},fxns,type=numeric):tl1:=odeplot(t, [y1(t),y2(t)],0...12, numpoints=100,view=[0...6,-3...3]): tl2:=odeplot(t, [y1(t),y2(t)],-12...0, numpoints=100,view=[0...6,-3...3]): zt:=dsolve({sys,y1(0)=7*Pi/4+.01,y2(0)=0},fxns,type=numeric): tl3:=odeplot(zt, [y1(t),y2(t)],0...4, numpoints=75,view=[0...6,-3...3]): tl4:=odeplot(zt, [y1(t),y2(t)],-4...0, numpoints=75,view=[0...6,-3...3]): #display the plots, after trying various combinations, it seems using only the odd trajectories gave the nicest output display({pl[1],pl[3],pl[5],pl[7],pl[9],pl[11],pl[13],ql[1],ql[3],ql[5],ql[7],ql[9],ql[11],ql[13],sl1,sl2,sl3,sl4,tl1,tl2,tl3,tl4},scaling=constrained);