3
$\begingroup$

I am trying to find the solution in order to highlight the intersection point.

Clear["Global`*"]
y[a_, k_, l_, d_] := a*k^d*l^(1 - d);
mpl[a_, k_, l_, d_] := (1 - d)*a*k^d*l^(-d);
lsupply[b_, m_, l_] := b + m*l;

intersectlabor[a_, k_, l_, d_, b_, m_] = {l, mpl[a, k, l, d]} /. 
  Assuming[Thread[{a, b, m, d, k} > 0], 
    Solve[{mpl[a, k, l, d] == lsupply[b, m, l], a > 0, b > 0, m > 0, 
       l > 0, k > 0, d > 0}, l] // Simplify][[1]]

Manipulate[
 Plot[{mpl[a, k, l, d], lsupply[b, m, l]}, {l, 0, 100}, 
  PlotRange -> {25, 1000}, AxesLabel -> {"L", "MPL, w"}, 
  LabelStyle -> Black, 
  Epilog -> {Blue, PointSize@Large, 
    Point@intersectlabor[a, k, l, d, b, m]}], {{a, 80, "A"}, 1, 
  100}, {{k, 350, "K"}, 200, 1000}, {{d, 1/3}, 10^-2, 1}, {{b, 4}, 0, 
  200}, {{m, 5}, 0, 10}]

It worked for a different application but now it is just running - also no error message.

Thank you!

$\endgroup$

2 Answers 2

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

y[a_, k_, l_, d_] := a*k^d*l^(1 - d);
mpl[a_, k_, l_, d_] := (1 - d)*a*k^d*l^(-d);
lsupply[b_, m_, l_] := b + m*l;

l should not be an argument to intersectlabor. Use NSolve

intersectlabor[a_?NumericQ, k_?NumericQ, d_?NumericQ, b_?NumericQ, 
  m_?NumericQ] := {l, mpl[a, k, l, d]} /. 
  NSolve[{mpl[a, k, l, d] == lsupply[b, m, l], a > 0, b > 0, m > 0, l > 0, 
     k > 0, d > 0}, l][[1]]

Manipulate[
 Plot[{mpl[a, k, l, d], lsupply[b, m, l]}, {l, 0, 100},
  PlotRange -> {25, 1000},
  AxesLabel -> {"L", "MPL, w"},
  LabelStyle -> Black, 
  Epilog -> {Blue, PointSize@Large,
    Point@intersectlabor[a, k, d, b, m]}], {{a, 80, "A"}, 1, 100, 1, 
  Appearance -> "Labeled"},
 {{k, 350, "K"}, 200, 1000, 5, Appearance -> "Labeled"},
 {{d, 0.3}, 0.01, 0.99, 0.01, Appearance -> "Labeled"},
 {{b, 4}, 2, 200, 2, Appearance -> "Labeled"},
 {{m, 5}, 0.1, 10, 0.1, Appearance -> "Labeled"}]

enter image description here

$\endgroup$
4
$\begingroup$

Mesh and MeshFunctions is work.

Here we write a MeshFunctions such as

MeshFunctions -> Function[l, mpl[a, k, l, d] - lsupply[b, m, l]]

and set Mesh->{{0}} indicate that mpl[a, k, l, d] - lsupply[b, m, l]==0,so we need not solve the equation by hand.

Clear["Global`*"]
y[a_, k_, l_, d_] = a*k^d*l^(1 - d);
mpl[a_, k_, l_, d_] = (1 - d)*a*k^d*l^(-d);
lsupply[b_, m_, l_] = b + m*l;

Manipulate[
 Plot[{mpl[a, k, l, d], lsupply[b, m, l]}, {l, 0, 100}, 
  PlotRange -> {25, 1000}, AxesLabel -> {"L", "MPL, w"}, 
  LabelStyle -> Black, Mesh -> {{0}}, 
  MeshStyle -> Directive[PointSize[Large], Red], 
  MeshFunctions -> 
   Function[l, mpl[a, k, l, d] - lsupply[b, m, l]]], {{a, 80, "A"}, 1,
   100}, {{k, 350, "K"}, 200, 1000}, {{d, 1/3}, 10^-2, 1}, {{b, 4}, 0,
   200}, {{m, 5}, 0, 10}]

enter image description here

$\endgroup$
1
  • $\begingroup$ I am going to keep/use this for another application where I don't need the values for other calculations. Thanks! $\endgroup$
    – Tom
    Commented Nov 19, 2020 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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