Vector plot does not take an equation as an argument

Click For Summary

Discussion Overview

The discussion revolves around the use of the VectorPlot function in Mathematica to graph the phase plane of a system of differential equations. Participants explore issues related to command syntax, plotting options, and alternative methods for visualizing vector fields.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Experimental/applied

Main Points Raised

  • One participant encounters an error when trying to use VectorPlot with equations and seeks help to resolve the issue.
  • Another participant suggests that VectorPlot requires expressions rather than equations and points out a potential error with variable evaluation.
  • A participant identifies a syntax error related to the inclusion of an extra variable in the VectorPlot command.
  • There is a question about how to display the origin in the plot, leading to a suggestion to use the Axes->True option.
  • Concerns are raised about the appearance of arrows fading towards the y-axis, with a suggestion to consider using StreamDensityPlot for a different visualization approach.
  • A participant attempts to plot circles around specific points but encounters another syntax error in the StreamDensityPlot command.
  • One participant mentions being unable to access Mathematica and suggests looking for an option called "Epilogue" to plot additional graphics primitives.

Areas of Agreement / Disagreement

Participants express differing views on the correct syntax and options for using VectorPlot and StreamDensityPlot, indicating that there is no consensus on the best approach to resolve the issues raised.

Contextual Notes

Participants discuss specific command syntax and options in Mathematica, highlighting potential limitations in their understanding or memory of the software's functionalities.

Nusc
Messages
752
Reaction score
2
VectorPlot[{D[x[t], t] == x[t] (4 - y[t] - x[t]^2),
D[y[t], t] == y[t] (-1 + x[t])}, {x, -10, 10}, {y, -10,
10}, {t, -10, 10}]

I'm trying to graph the phase plane of these equations. I get an error, what's wrong with my command?
 
Physics news on Phys.org


Vector plot does not take an equation as an argument. You need to put the expressions in instead of the equations. Also, if you have the expression x[t] you cannot evaluate it at x=10 since that would be 10[t] which is going to throw an error. I think the correct command is:

VectorPlot[{x (4 - y - x^2), y (-1 + x)}, {x, -10, 10}, {y, -10, 10}, {t, -10, 10}]
 


VectorPlot::nonopt: Options expected (instead of {t,-10,10}) beyond position 3 in VectorPlot[{x (4-y-x^2),y (-1+x)},{x,-10,10},{y,-10,10},{t,-10,10}]. An option must be a rule or a list of rules. >>
 


Oops, I missed that.

VectorPlot[{x (4 - y - x^2), y (-1 + x)}, {x, -10, 10}, {y, -10, 10}]
 


How do I get mathematica to show the origin? it just fades in the middle.
 


Use the option

Axes->True
 


What about the arrows that fade towards the y-axis

and how do I plot circles around the points (-2,0),(1,3),(2,0),(0,0)?
 


The arrows towards the y-axis appear to fade because VectorPlot plots both the magnitude and the direction of each vector, so a region with a lower magnitude is represented by shorter vectors. If you do not like this behavior you might consider using StreamDensityPlot instead of VectorPlot. Stream density plot shows the direction of the field using arrows and the magnitude using a background shading.
 


Thanks for the help!

and how do I plot circles around the points (-2,0),(1,3),(2,0),(0,0)?

StreamDensityPlot[{x (4 - y - x^2),
y (-1 + x)}, {Circle[{-2, 0}, 1]}, {x, -10, 10}, {y, -10, 10},
Axes -> True]

StreamDensityPlot::nonopt: Options expected (instead of {y,-10,10}) beyond position 3 in StreamDensityPlot[{x (4-y-x^2),y (-1+x)},{Circle[{-2,0},1]},{x,-10,10},{y,-10,10},Axes->True]. An option must be a rule or a list of rules. >>
 
Last edited:
  • #10


Unfortunately I am traveling and can't access Mathematica until thursday. However, if my memory is correct there is an option called Epilogue or something similar that you can use to plot any arbitrary list of graphics primitives. Try a search for "Epilogue" in the online help and if I misremembered the name then you will have to look through the list of options for StreamDensityPlot, Plot, and Graphics until you find it.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K