Re: Nullcline and getting "2" values for y
- To: mathgroup at smc.vnet.net
- Subject: [mg81471] Re: Nullcline and getting "2" values for y
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 26 Sep 2007 06:22:11 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <fd7s8h$cgc$1@smc.vnet.net>
sean_incali wrote: > I have this equation I can plot using the following > > ClearAll["Global`*"] > > > fun = (b c y - a y^ n + y^(1 + n))/(b + y^n); > d = 0.1; > c = 1; > b = 10; > a = 11; > n = 5; > ParametricPlot[{fun, (y)}, {y, 0, 1}, PlotRange -> All] > > I am plotting the function "fun" against values of y. > > When I do that I get a curvew that clearly shows that, for a given > value of y, I should get two value for the function. > > How do I get what they are? > > If I just go.. > > d = 0.1; > c = 1; > b = 10; > a = 11; > n = 2; Note that the value of n has changed: the first graph was done with n == 5 whereas this one is drawn with n == 2. > y = 0.5; > > (b c y - a y^ n + y^(1 + n))/(b + y^n) > > I get > > 0.231707 > > but starting at y=0 all the way to y= 0.6 or so, there are two values! > (according to the graph) > > How do I get what those values are? Hi Sean, I am not sure to have followed or understood correctly what you attempted to do; nevertheless, I believe that the following will help. First, let's rewrite the 'equation' as a function of y and set the parameters as a list of replacement rules. In[1]:= fun[y_] := (b c y - a y^n + y^(1 + n))/(b + y^n) params = {d -> 1/10, c -> 1, b -> 10, a -> 11, n -> 5}; ParametricPlot[{fun[y] /. params, y}, {y, 0, 1}, PlotRange -> All] [... graphic deleted ...] In[4]:= fun[0.5] /. params Out[4]= 0.465732 The above value is indeed correct and unique. It correspond to the value of f[y] when y is equal to 1/2, as you can see in the plot below. In[5]:= Plot[fun[y] /. params, {y, 0, 1}] [... graphic deleted ...] So what you are looking for is the solutions to the equation f[y] == 1/2, that is, "For which values of y do we have f[y] equal to a half?" This can be answer by either *Solve* or *Reduce*, the advantage of *Reduce* is that we can use inequalities in addition to equations. In[6]:= Solve[fun[y] == 1/2 /. params, y] Out[6]= {{y -> Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 1]}, {y -> Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 2]}, {y -> Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 3]}, {y -> Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 4]}, {y -> Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 5]}, {y -> Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 6]}} In[7]:= Reduce[{fun[y] == 1/2 /. params, 0 <= y <= 1}, y] Out[7]= y == Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 2] || y == Root[-10 + 20 #1 - 23 #1^5 + 2 #1^6 &, 3] In[8]:= % // N Out[8]= y == 0.560536 || y == 0.742059 Regards, -- Jean-Marc