Mathematica - How to Graph Direction Fields of ODEs?

  • Context: Mathematica 
  • Thread starter Thread starter Ascendant0
  • Start date Start date
  • Tags Tags
    Direction Fields Graph
Click For Summary

Discussion Overview

The discussion centers around how to graph direction fields for ordinary differential equations (ODEs) using Mathematica. Participants explore the use of specific commands like VectorPlot and seek clarification on input requirements and the underlying concepts of direction fields.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant seeks guidance on how to graph direction fields for ODEs in Mathematica, specifically mentioning the equation y′+xy=x.
  • Another participant provides a vector plot example related to the requested equation, indicating that Mathematica can interpret the equation without additional input.
  • A participant expresses confusion about the meaning of the "1" in the VectorPlot command, questioning whether it signifies a first-order differential equation.
  • There is a discussion about the basic concept of plotting direction fields by hand, with one participant explaining the process of determining slopes at given points.
  • Another participant challenges a claim regarding the plotting of direction fields, emphasizing that vectors must be plotted at each point rather than just numerical slopes.
  • A participant clarifies their understanding of direction fields and expresses frustration over the tangential nature of the discussion, while also indicating they have made progress in understanding the VectorPlot command.

Areas of Agreement / Disagreement

Participants demonstrate a mix of understanding and confusion regarding the specifics of using Mathematica for direction fields. While some agree on the basic concepts, there is disagreement on the interpretation of certain inputs and the nature of plotting direction fields.

Contextual Notes

Participants express uncertainty about specific Mathematica commands and their implications, as well as the interpretation of input parameters. The discussion does not resolve these uncertainties, leaving some questions about the software's functionality and the mathematical concepts involved open.

Ascendant0
Messages
177
Reaction score
37
So, I'm working on ODE at this point, and unfortunately I don't have the time to learn all of the Mathematica input for at least a few months. But, I was hoping someone could tell me how to graph direction fields of ODEs, either with the Mathematica input or free-form?

Looking through the Mathematica site, it looks like VectorPlot or VectorPlot3D is one of the two commands I'd be looking to use, but the two pages I found on the site show information that went over my head. I don't know how to enter in what I'm looking to do.

Basically, I want to be able to take something like y′+xy=x, and create a graph of the direction field within a given region. I wanted to take a little time to do this for multiple equations (including some of the ones I'm seeing in the OpenCourseWare lectures), so that I can get a better idea of the general type of field for certain types of ODEs (without having to take the time to put them together myself). Any help here would be greatly appreciated.
 
Physics news on Phys.org
Ascendant0 said:
I don't know how to enter in what I'm looking to do.
Is this what you want?

1721206597868.png
 
  • Like
Likes   Reactions: Ascendant0
renormalize said:
Is this what you want?

View attachment 348450
Yes, that's the type of thing I'm looking to do. How would I go about plugging a differential equation into a vector plot like that?
 
Ascendant0 said:
Yes, that's the type of thing I'm looking to do. How would I go about plugging a differential equation into a vector plot like that?
Post #2 is the vector plot of the 1rst-order differential equation you gave: y′+xy=x.
 
  • Like
Likes   Reactions: Ascendant0
renormalize said:
Post #2 is the vector plot of the 1rst-order differential equation you gave: y′+xy=x.
Oh, ok I got you. So it automatically assumes it as an equation for y' without having to plug it into the input. Thank you, I appreciate the help
 
renormalize said:
Post #2 is the vector plot of the 1rst-order differential equation you gave: y′+xy=x.
I did have one other question in regards to that input. The "1" in front of the "x - xy", is that for "first order differential", or something else?
 
Ascendant0 said:
I did have one other question in regards to that input. The "1" in front of the "x - xy", is that for "first order differential", or something else?
Do you understand the basic idea of plotting a "direction-" or a "slope-" field? Can you describe how you'd do it by hand with pencil and paper (before worrying about how it's done in a particular software like Mathematica)?
 
renormalize said:
Do you understand the basic idea of plotting a "direction-" or a "slope-" field? Can you describe how you'd do it by hand with pencil and paper (before worrying about how it's done in a particular software like Mathematica)?
Yea, I have all that down. You plug in x, plug in y, then the answer gives you the slope at that location.

Like ##dy/dx = 2x^2 - 3y^3 ##; at x = 2 and y = 3, ##dy/dx = -73## (which is the slope)

If I didn't even know how to do that yet, it wouldn't be making much sense to be asking how to put it into Mathematica, lol.

But anyway, still not sure what the "1" in the front of the equation in VectorPlot means. What I do know is if I plug "y" in there instead of the 1, I get vectors in a circle. Looked around on the web, and I don't see anything from Mathematica that clarifies it for me.
 
Ascendant0 said:
Yea, I have all that down. You plug in x, plug in y, then the answer gives you the slope at that location.

Like ##dy/dx = 2x^2 - 3y^3 ##; at x = 2 and y = 3, ##dy/dx = -73## (which is the slope)

If I didn't even know how to do that yet, it wouldn't be making much sense to be asking how to put it into Mathematica, lol.
You apparently don't understand because that's not the way to plot a direction-field. At each point ##x,y## you must to plot a vector, not a number like "##-73##". Please read https://en.wikipedia.org/wiki/Slope_field to learn how.
 
  • #10
renormalize said:
You apparently don't understand because that's not the way to plot a direction-field. At each point ##x,y## you must to plot a vector, not a number like "##-73##". Please read https://en.wikipedia.org/wiki/Slope_field to learn how.
How are you going to plot a direction field without knowing what the slope is at any given location? Did I say "draw a -73 there"? No, but without the slope, you most certainly aren't going to draw the direction field, which I'm well more than aware on how to draw. What I don't know is a specific part of the VectorPlot command above, and this is become completely tangential and irrelevant to what I'm trying to learn. I've plotted direction fields multiple times now by hand, just wasn't sure with VectorPlot, but I think I've figured it out between your previous help and testing various equations. I appreciate it.
 
  • Like
Likes   Reactions: renormalize

Similar threads

  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 21 ·
Replies
21
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K