Re: directionfields from StreamPlot looks different from solution

*To*: mathgroup at smc.vnet.net*Subject*: [mg100483] Re: [mg100444] directionfields from StreamPlot looks different from solution*From*: sean k <sean_incali at yahoo.com>*Date*: Fri, 5 Jun 2009 03:03:22 -0400 (EDT)*Reply-to*: sean_incali at yahoo.com

Hi Murray, Thanks for the suggestion regarding 1 dimensional ode. How would you use StreamPlot for the following system? a'[t] == - k1 (t ^-h) a[t] - k2 (t ^-h) b[t], b'[t] == k1 (t ^-h) a[t] --- On Thu, 6/4/09, Murray Eisenberg <murray at math.umass.edu> wrote: > From: Murray Eisenberg <murray at math.umass.edu> > Subject: Re: [mg100444] directionfields from StreamPlot looks different f= rom solution > To: mathgroup at smc.vnet.net > Date: Thursday, June 4, 2009, 8:25 AM > You're not. For the "direction > field" of a 1-dimensional ordinary differential equation y' > == f[t, y], the vector field you want to plot is {1, > f[t,y]}. So... > > streams = > StreamPlot[{1, t^2 - y}, {t, -4, 4}, {y, -2, 10}, > StreamStyle -> > Directive[Orange]]; > sol = Table[NDSolve[{y'[t] == t^2 - y[t], y[0] == > y0}, y[t], > {t, -4, 4}], > {y0, 0, 6, 0.5}]; > solutionCurves = > Plot[y[t] /. sol, {t, -4, 4}, > PlotRange -> {{-4, 4}, {-2, 10}}]; > Show[{solutionCurves, streams} > > Note that you do not need any parentheses around t^2. And > in the current version of Mathematica, you no longer need to > wrap y[t]/.sol with Evaluate -- unless you would like the > curves automatically to be given different colors. > > sean_incali at yahoo.com > wrote: > > I don't think I'm using StreamPlot properly. > > > > Consider the following non-autonomous ODE > > > > y'[t] == (t^2) - y[t] > > > > Solutions for various ICs can be viewed by the > following. > > > > sol= Table[NDSolve[{y'[t] == (t^2) - y[t], y[0] == > y0}, y[t], {t, -4, > > 4}], {y0, 0, 6, 0.5}]; > > > > Plot[Evaluate[y[t] /. sol], {t, -4, 4}, PlotRange > -> {{-4, 4}, {-2, > > 10}}] > > > > Shouldn't Vector fields be similar to the solutions > above? If I plot t > > on x-axis vs. t^2-y on y axis... > > > > VectorPlot[{t, (t^2) - y}, {t, -4, 4}, {y, -2, 10}] > > > > StreamPlot[{t, (t^2) - y}, {t, -4, 4}, {y, -2, 10}] > > > > I don't get similar results... > > > > What is the reason for this? > > > > Thanks much in advance > > > > Sean > > > > > > > > > > -- Murray Eisenberg > murray at math.umass.edu > Mathematics & Statistics Dept. > Lederle Graduate Research Tower phone > 413 549-1020 (H) > University of Massachusetts > 413 545-2859 (W) > 710 North Pleasant Street > fax 413 545-1801 > Amherst, MA 01003-9305 > =0A=0A=0A