RE: direction fields for diff eqns in mathematica 3.0?
- To: mathgroup at smc.vnet.net
- Subject: [mg25023] RE: [mg25018] direction fields for diff eqns in mathematica 3.0?
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 1 Sep 2000 21:57:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Here is a simple differential equation:
y'[x] == y[x]^2
A direction field vector would be given by:
v = {1, y^2}
To plot the direction field I found it easiest to normalize the vector.
v/Sqrt[v.v]
{1/Sqrt[1 + y^4], y^2/Sqrt[1 + y^4]}
This plots the direction field.
Needs["Graphics`PlotField`"]
Needs["Graphics`Colors`"]
PlotVectorField[{1, y^2}/Sqrt[1 + y^4], {x, -3, 3}, {y, -7, 7},
ScaleFunction -> None, HeadLength -> 0, AspectRatio -> 1,
PlotRange -> {{-4, 4}, {-10, 10}}, Background -> Linen, Frame -> True,
FrameLabel -> {x, y}, PlotLabel -> Derivative[1][y][x] == y[x]^2,
ImageSize -> 600];
The plots usually look a little nicer if you make the PlotRange somewhat
larger than the iterator range; otherwise some of the lines may overshoot
the frame.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
> -----Original Message-----
> From: Ed [mailto:ejh at idcomm.com]
To: mathgroup at smc.vnet.net
>
> Howdy all!
>
> I cannot find a simple way to do direction field plots for
> differential equations. I mean the plots which show the slope of the
> solutions curves at each point.
>
> What am I missing? Do I use something fancy with the vector plot
> functions?
>
> Thanks!
>
> Ed