# Maple - Phase Portraits

The phaseportrait command provides an easy and clean way to plot direction fields and solution curves of 1- and 2-D systems. Its syntax is very like that for the dfieldplot command.

```  phaseportrait(DEs,dependent variables,t range,[ICs],dependent variable ranges);
```
For example, we could plot a couple of solutions to the differential equation y' = y cos y using the command
```  with(DEtools):
phaseportrait(diff(y(t),t)=y(t)*cos(y(t)),y,t=-5..5,[y(0)=1,y(0)=-1],y=-Pi..Pi,color=aquamarine,linecolor=blue);
```
which yields the image below.

We can use this same function for second order equations or 2-D systems. For example, if we want to plot a phase portrait for the second order equation y'' + (cos y) y = 0, then we first convert it to a system:
y' = z
z' = -y cos y
and then apply the phaseportrait function to that.

```  DE1 := diff(y(t),t) = z(t);
DE2 := diff(z(t),t) = -y(t)*cos(y(t));
phaseportrait([DE1,DE2],[y,z],t=-5..5,[[y(0)=1,z(0)=0],[y(0)=0,z(0)=2],[y(0)=0,z(0)=-2]],y=-Pi..Pi,z=-3..3,color=aquamarine,linecolor=blue);
```
This produces the plot

There are a few things worth noting here. First, the solution curves are traced both forwards and backwards in time. Without actually plotting a point where the IC is located, you will not be able to identify the initial point. Second, note that the function plots a direction field for autonomous equations, but does not do that for the 2-D case if the equation is not autonomous. Changing the equation to
y' = z
z' = -y cos t
and applying the phaseportrait function to that

```  DE1 := diff(y(t),t) = z(t);
DE2 := diff(z(t),t) = -y(t)*cos(t);
phaseportrait([DE1,DE2],[y,z],t=-5..5,[[y(0)=1,z(0)=0],[y(0)=0,z(0)=2],[y(0)=0,z(0)=-2]],y=-Pi..Pi,z=-3..3,color=aquamarine,linecolor=blue);
```
produces the plot

The point is that since the equation is no longer autonomous, then solutions can cross and so on, so the notion of direction field is no longer meaningful. Of course, we could make the equation autonomous by inserting a third variable, but we can't do 3-D phaseportraits with this function.

This class will run from Monday, 7 June, until Friday, 30 July.

I have started posting homework. It will be due each week on Wednesday, during class. I will usually not post the entire week's homework at once. Check this every day to see what is up. Homework assigned on Tuesdays will not be due until the following week.

The TA for this class is Giang Trinh. He holds office hours from 3:00 to 4:20 every Monday and Friday. Go see him if you have questions about homework grading, or if you cannot make the instructor's hours, or if you just prefer his explanations.

The final exam will take place on Thursday, 29 July, from 6-9 PM in our usual classroom, Wegner G1. Class will be cancelled on Thursday and Friday, 29 and 30 July, to compensate for this special lengthened exam time. The instructor will be present in the classroom at the normal class time on Thursday for an optional help session.

There is a sample final exam posted. The tables you will have available are also posted.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us