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$

2 Answers 2

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

$\endgroup$
1
  • $\begingroup$ Thank you, this seems to be what I was looking for! +1 $\endgroup$ Jul 13, 2012 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]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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