Re: directionfields from StreamPlot looks

*To*: mathgroup at smc.vnet.net*Subject*: [mg100642] Re: directionfields from StreamPlot looks*From*: sean_incali at yahoo.com*Date*: Wed, 10 Jun 2009 05:33:14 -0400 (EDT)*References*: <200906050703.DAA25606@smc.vnet.net> <h0d72j$srt$1@smc.vnet.net>

Correction. I just realized that Lynch does have the codes for doing the Poincare section. It's in the notebook on Mathematica website under his book page. (no method of multiple scales though.) On Jun 6, 3:26 am, sean_inc... at yahoo.com wrote: > Thanks a lot again for the input. I am so glad to have asked this > question. That system was a simpler version other systems I was > working on. > > What you're doing with Manipulate[] is more or less what I've been > doing except I wasn't sure if I was doing it right or not. (And as > seen with the previous example I gave, I was getting confused about > StreamPlot in general) > > I was taking the RHS of the two ODEs and using the StreamPlot to get > an idea of what the solutions look like. Not much unlike plotting > solutions in phase space (is that acceptable? based on your post, it > seems like it is...) > > Except now the trajectories in that space represent the a' and b' > instead of a and b as the normal phase portraits should be(?) > > Is this ok? (Does this give an hint as to the actual solutions of the > system?) > > k1 and k2 are pseudo first order reaction rate constants. It can range > from 10^-3 to 10^7 or so. (for diffusion limited process) h range > from 0 to 1. > > The system above is kinda simplified... The system below behaves a bit > more interestingly. (Let's say...k1=3, k2=7, t=50 and then...) > > Manipulate[ > StreamPlot[{va - k1 (t^-h) a - k2 ( t^-h ) b, k1 (t^-h ) a - db}, > {a, -10, 10}, {b, -10, 10}], {k1, 0.01,10}, {k2, 0.01, 10}, {t, 0.1, > 50}, {h, 0, 1}, {va, 0.1, 10}, {db, 0.1, 10}] > > As you vary va, db, and h, you will see the center of stable attractor > shifts. > > This is entirely a different post, but if I wanted to see a poincare > section of that system, will that be doable in mathematica? Seems > Like Stephen Lynch's book uses 3 different CAs to generate the > figures. And Mathematica version doesn't have the codes for poincare > section shown in fig 8.11 b. > > I'll probably start another post about it. Sometime this week... > > On Jun 6, 12:49 am, Murray Eisenberg <mur... at math.umass.edu> wrote: > > > What are k1, k2, and h? > > > Once you have fixed values for those, then you have a non-autonomous > > system of two first order differential equations. So you're asking h= er= > e > > about a time-dependent vector field in the (a,b)-plane: > > > F[t_, a_, b_] := {-k1 t^-h a - k2 t^-h b, k1 t^-h a} > > > Actually, this is not defined at time t=0. > > > There are (at least) two methods for visualizing that. > > > Method 1: For particular individual values of t, form an ordinary 2D > > StreamPlot or VectorPlot. Here, let's take: > > > k1=10;k2=2;h=1; > > > And the time-dependent vector field will be given by: > > > F[t_,a_,b_]={-k1 t^-h a-k2 t^-h b,k1 t^-h a}; > > > Then form a grid of snapshots of the vector field at different times: > > > Grid[Partition[ > > Table[ > > StreamPlot[F[t,a,b], {a,-10,10}, {b,-10,10}], {t, 0.1, 2= 4,= > 2}], > > 4]] > > > Or, better yet, use Manipulate so that you can dynamically change the > > time and hence the value of the field: > > > Manipulate[ > > StreamPlot[F[t, a, b], {a, -10, 10}, {b, -10, 10}], > > {t, 0.1, 24, 2}] > > > For the values of k1, k2, and h I picked, and on the {a,b} domain and > > the t range, there does not seem to be much change in the field. > > > Method 2: Represent the time-varying field F as a function on {t,a,b} > > space. Then you could do something like: > > > G[t_, a_, b_] = Flatten[{1, F[t, a, b]}] > > > VectorPlot3D[G[t, a, b], {t, 0.1, 24}, {a, -10, 10}, {b, -10, 10= }] > > > sean k wrote: > > > 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 <mur... at math.umass.edu> wrote: > > > >> From: Murray Eisenberg <mur... at math.umass.edu> > > >> Subject: Re: directionfields from StreamPlot looks different f= > > > rom solution > > >> To: mathgr... 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_inc... 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 > > >> mur... 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 > > > -- > > Murray Eisenberg mur... at math.um= as= > s.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

**References**:**Re: directionfields from StreamPlot looks different from solution***From:*sean k <sean_incali@yahoo.com>

**RE: Re: Re: Re: directionfields from StreamPlot**

**manipulate contourplot question**

**RE: Re: Re: Re: directionfields from StreamPlot**

**Re: directionfields from StreamPlot looks different from solution**