1
$\begingroup$

I have an implicit function, and I'm trying to plot the derivative of the solution of this function.

The function is:


p = \[Phi]/(1/\[Beta]) + ((1 - \[Phi]) \[Phi] (1 - \[Lambda]) \
\[Beta])/(((W - A) 1/\[Beta] + \[Phi] A/
      p) 1/\[Beta] + \[Phi]*(1 - \[Phi]) A/p)/(
 1/\[Beta] (\[Lambda]/((W - A) 1/\[Beta] + \[Phi] (A/
      p)  ) + (1 - \[Lambda])/(((W - A) 1/\[Beta] + \[Phi] A/
         p) 1/\[Beta] + \[Phi] (1 - \[Phi]) A/p)))

And I would like to plot the derivative of the following expression w.r.t \[Phi]

\[Phi]/p ((1-\[Phi]) A + 1/\[Beta] A )

I've been trying to first solve for p explicitly, and plug the solution into the expression above and plot the derivative of the expression, but kept getting an error. My code is :

Manipulate[
 ans = p /. 
   Solve[p - \[Phi]/(
      1/\[Beta]) - ((1 - \[Phi]) \[Phi] (1 - \[Lambda]) \[Beta])/(((W \
- A) 1/\[Beta] + \[Phi] A/p) 1/\[Beta] + \[Phi]*(1 - \[Phi]) A/p)/(
      1/\[Beta] (\[Lambda]/((W - A) 1/\[Beta] + \[Phi] (A/
           p)  ) + (1 - \[Lambda])/(((W - A) 1/\[Beta] + \[Phi] A/
              p) 1/\[Beta] + \[Phi] (1 - \[Phi]) A/p))) == 0, p],
 Plot[Evaluate[
   D[f[\[Phi]] == \[Phi]/
      ans[[2]] ((1 - \[Phi]) A + 1/\[Beta] A), \[Phi]]], {\[Phi], 
   0.01, 1}], {A, 10, 500}, {\[Beta], 0.001, 1}, {W, 100, 
  10^9}, {\[Lambda], 0.01, 1}]

The error I'm getting is:

"Manipulate:Manipulate argument \
Plot[Evaluate[\!\(\*SubscriptBox[\(\[PartialD]\), \(\[Phi]\)]\((f[\
\[Phi]] == \((\[Phi]\\\ Power[<<2>>])\)\\\ \((Times[<<2>>] + 
     Times[<<2>>])\))\)\)],{\[Phi],0.01,1}] does not have the correct \
form for a variable specification"

What am I doing wrong?

Thank you!

$\endgroup$

1 Answer 1

1
$\begingroup$
Clear["Global`*"]

Manipulate[
 Module[{ans, f,
   β = Rationalize[ββ, 0],
   λ = Rationalize[λλ, 0]},
  ans = Solve[
    p == ϕ/(1/β) + ((1 - ϕ) ϕ (1 - λ) \
β)/(((W - A) 1/β + ϕ A/
               p) 1/β + ϕ*(1 - ϕ) A/
            p)/(1/β (λ/((W - A) 1/β + ϕ (A/
                 p)) + (1 - λ)/(((W - A) 1/β + ϕ A/
                   p) 1/β + ϕ (1 - ϕ) A/p))), p]; 
  f = D[ϕ/p ((1 - ϕ) A + 1/β A) /. ans, ϕ] // 
    Simplify;
  Plot[Evaluate@f, {ϕ, 0.01, 1},
   PlotLegends -> Automatic]],
 {{A, 10}, 10, 500, 1,
  Appearance -> "Labeled"},
 {{ββ, 0.001, "β"}, 0.001, 1, 0.001,
  Appearance -> "Labeled"},
 {{W, 100}, Outer[Times, {1, 2, 5, 7, 10},
     10^Range[2, 8]] // Flatten // Union},
 {{λλ, 0.01, "λ"}, 0.01, 1, 0.002,
  Appearance -> "Labeled"}]

enter image description here

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.