6
$\begingroup$

I am trying to make a visual representation of the curve $y=x^{2}$, with $x\in\left[0,1\right]$ in the vector field defined by $\vec{F}=\left[-y,x\right]$.

However, as far as I can tell there does not seem to be any facility which allows me to do this in Mathematica (I've looked through as much of the documentation as I could find which seemed pertinent).

I know how to do each of these separately, e.g.

Plot[x^2,{x,0,1}]
VectorPlot[{-y,x},{x,-3,3},{y,-3,3}]

However, I am unsure how I can combine these two plots (or plot them both at the same time).

Thanks in advance!

$\endgroup$
12
$\begingroup$

You should make use of Show and appropriate options e.g. we added PlotRange, AspectRatio etc. :

Show[{ Plot[x^2, {x, -3, 3}, PlotRange -> 3, PlotStyle -> {Thick, Darker @ Green}],
       VectorPlot[{-y, x}, {x, -3, 3}, {y, -3, 3}]}, AspectRatio -> 1]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you, this seems to be what I was looking for! +1 $\endgroup$ – Thomas Russell Jul 13 '12 at 23:21
5
$\begingroup$

Instead of using Show you might prefer the paradigm of David Park's Presentations package:

<< Presentations`

Draw2D[{VectorDraw[{-y, x}, {x, -3, 3}, {y, -3, 3}],
        Darker@Green, Draw[x^2, {x, -3, 3}]},
       PlotRange->3, Axes->True]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.