I shall reformulate my question with a better attempt.

My goal is to plot a (alleged) function ee[..] which depends on another function f stationary points and derivatives which itself depend on two other parameters betta and h. I would like to plot ee[h_,..] and eventually stick the Plot[ee[h_,..] into a Manipulate[...,{betta,1,2}. For now, betta = 1.264.

(* Source of dependency on h *)
betta = 1.264;
f[x_, b_, h_] := -0.5*x^2 - 
   h*x + (1/b)*0.5*((1 + x)*Log[1 + x] + (1 - x)*Log[1 - x]);

(* Function to be plotted*)
ee[fmstar_, fmbar_, mstar_, mbar_, fmb_, fms_, b_, h_] := 
  Exp[fmbar - fmstar]*Sqrt[(1 - mstar)/(1 - mbar)]*

(* Define max, min and second derivative of f as func. of h, I know how f behaves and so I expect it to have one local max near zero and 2 mins on the left and on the right. I pick the left one. *)
fmax[h_] := FindMaximum[{f[x, betta, h], -1 < x < 1}, {x, 0}];
fmin[h_] := FindMinimum[{f[x, betta, h], -1 < x < 1}, {x, -0.05}]
fxx[h_] := D[f[x, betta, h], {x, 2}];

(* Try to supply the various parameter and plot *)
    mstar = x /. (fmax[h])[[2]],
    mbar = x /. (fmin[h])[[2]],
    fxx[h] /. x -> mbar,
    fxx[h] /. x -> mstar,
    betta, h]
  {h, 0.005, -0.005},
  ImageSize -> 500

but I get an empty plot here.

If you need to inspect f this manipulate is convenient.

Manipulate[Plot[f[x, b, h], {x, -1, 1}, GridLines -> {{-0.5, 0.5}}, ImageSize -> 500], {b, 0.2, 2}, {h, -1, 1}]

For my purposes

$ -1<x<1, b >1$ and $h\in(\pm \frac{1}{2b}\sqrt{1-\frac{1}{b}})$

  • $\begingroup$ I am still not quite sure what you trie to achive, but you should have a look at the output structure of FindMinimum. Also you have some problems with complex values which cannot be plotted. $\endgroup$ – meneken17 Oct 7 '16 at 9:09
  • $\begingroup$ I know I have some points where this should not work, but it is ok for me to work in a subset of the parameter where all minima and maxima are well defined. What I want is just plotting the ee[] function as a function of h. Only, ee depends on h in a funny way through the position of minima and maxima of the f function. $\endgroup$ – Three Diag Oct 7 '16 at 11:16
  • $\begingroup$ @meneken17 I have reformulated the question, hopefully is clearer now. $\endgroup$ – Three Diag Oct 7 '16 at 13:52
  • $\begingroup$ Much clearer now. There are 2 mistakes: 1) in the definition of ee you use fmb did you mean 'fmm'? 2) fxx only has 1 argumetn, but you call it with 3 in the plot command. $\endgroup$ – meneken17 Oct 7 '16 at 14:04
  • $\begingroup$ Right I was fixing those, but I am not sure, should I just declare it w/ three arguments fxx? $\endgroup$ – Three Diag Oct 7 '16 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.