Message Boards Message Boards

How to plot multiple equilibria?

Posted 8 years ago

I have a function

In[186]:= v[k_, x_] = u1[x] - u2[x]

Out[186]= 1 - 10 (2 - k)^x + (1 - k)/(2 k) - 2 k - k/(2 (1 - k)) + 
 10 (1 + k)^x + 1/2 (-(1 - k)^2 - k^2) + 1/2 ((1 - k)^2 + k^2) - 
 Log[2/(Sqrt[15] Sqrt[(1 - k)/k])] + 
 Log[(2 Sqrt[3/5])/Sqrt[k/(1 - k)]]

k is the variable of interest and x is a parameter. A solution is found when v[k,x]==0. As x increases multiple equilibria arise. What I want to do is have a plot that shows the multiple equilibria, i.e. a function k[x], to see the point where multiple equilibria arise. I tried to write the function as the following:

k1[x_] := FindRoot[v[k, x] == 0, {k, 1}]

k1[x_?NumericQ] := k /. FindRoot[v[k, x] == 0, {k, .5}]

This provides a solution, but only provides a local solution around the starting point and if I change the starting point I get a different solution. How can I plot a figure that will show all the equilibria over a certain range? Any help would be appreciated.

POSTED BY: Juan Lopez

This is a way:

v[k_, x_] = 
  1 - 10 (2 - k)^x + (1 - k)/(2 k) - 2 k - k/(2 (1 - k)) + 
   10 (1 + k)^x + 1/2 (-(1 - k)^2 - k^2) + 1/2 ((1 - k)^2 + k^2) - 
   Log[2/(Sqrt[15] Sqrt[(1 - k)/k])] + 
   Log[(2 Sqrt[3/5])/Sqrt[k/(1 - k)]];
Manipulate[
     Plot[v[k, x], {k, 0, 1}, 
      Epilog -> {PointSize[Large], 
        Point[{k, 0} /. 
          Solve[Rationalize[v[k, x]] == 0 && 0 < k < 1, k]]}], {x, 0, 4}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract