# Direction Field

1. Feb 26, 2005

I've had quite a bit of difficulty to properly fit into the screen the direction field plot of

$$y^{\prime}=te^{-2t}-2y$$​

which is happening because the solution to this differential equation is pretty ugly. I'm working in Mathematica 5. The plot and the notebook are attached so that you can have a clear idea of what I'm talking about.

Any help is highly appreciated.

#### Attached Files:

File size:
11.6 KB
Views:
67
• ###### mathematica notebook.zip
File size:
7.9 KB
Views:
51
2. Feb 26, 2005

### Davorak

When ploting a vector feild don't you usally plot y' vs y'. In other words you should not need to use t in your answer right?

3. Feb 27, 2005

I don't think so. In this case, I have $$y(t)$$---i.e. $$y$$ is a function of $$t$$. So, I'd definitely need axes for both of those. By the way, I could have used $$x$$ instead of $$t$$. I just find it convenient this way. I don't mean to plot $$y^{\prime} \mbox{ vs } y^{\prime}$$ because it does not represent a direction field.

Anyway, I've used the same type of commands (found in the mathematica notebook attached to the 1st post) to get various direction fields, but this one happens not to work exactly how I expected. I don't see those small arrows throughout. There are fewer and they appear much larger. Maybe, it's just a matter of getting the right window settings, which I haven't been able to achieve so far.

Thank you

4. Feb 27, 2005

### ehild

It is not that ugly.

$$y=(t^2/2+C)\exp(-2t)$$

I've plotted the direction field in the range (-1,1) for both t and y.

ehild

Last edited: Jun 29, 2010
5. Feb 28, 2005

Unfortunately, I still get the same kind of picture. Have you done that in mathematica 5? I'm trying to do it w/ the command "PlotVectorField", using the range you've suggested, but it just won't work.

Thanks

6. Feb 28, 2005

### Davorak

Sorry about that what I meant was Y' vs y. Right now in your Mathematica file you have y vs t and for the y component of the vector you have a constant 1. I am pretty sure Y should not be a constant 1. ehild gave a nice form for the solution of Y.

I also get what ehild does when plotting the vector field Y vs t, I how ever need to assume a constant. How did you get around this ehild? Or did you?

7. Mar 1, 2005

### ehild

It was made by an old program called NPHASER. It handles systems of first order differential equations of form xi = fi(x1...xn). In this case, x1 = t, x2=y, and the system is
x1'=1
x2'=x1(exp(-2x1))-2x2

I do not need any constant, but should input the range on both the x and y axes (t and y) and the grid size. The program draws a little arrow (all of equal length) to any grid points (t,y), with tangent equal to x2'/x1', that is y' in our case.

ehild

8. Mar 1, 2005

The constant 1 you refer to is separeted by a comma from the right-hand side of the differential equation. It indicates the 1st derivative. I've got it from a manual, and that syntax works fine for most problems. It should be something else (maybe one of the options).

Is there anybody who frequently uses "PlotVectorField" in mathematica 5?

Thanks