Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Direction Field

  1. Feb 26, 2005 #1
    I've had quite a bit of difficulty to properly fit into the screen the direction field plot of


    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:

  2. jcsd
  3. Feb 26, 2005 #2
    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?
  4. Feb 27, 2005 #3
    I don't think so. In this case, I have [tex]y(t)[/tex]---i.e. [tex]y[/tex] is a function of [tex]t[/tex]. So, I'd definitely need axes for both of those. By the way, I could have used [tex]x[/tex] instead of [tex]t[/tex]. I just find it convenient this way. I don't mean to plot [tex]y^{\prime} \mbox{ vs } y^{\prime}[/tex] 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
  5. Feb 27, 2005 #4


    User Avatar
    Homework Helper

    It is not that ugly.


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

    Last edited: Jun 29, 2010
  6. Feb 28, 2005 #5
    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.

  7. Feb 28, 2005 #6
    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?
  8. Mar 1, 2005 #7


    User Avatar
    Homework Helper

    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

    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.

  9. Mar 1, 2005 #8
    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?

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook