TransWikia.com

System of equations does not solve with Solve

Mathematica Asked on December 27, 2020

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!

2 Answers

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

Correct answer by Bob Hanlon on December 27, 2020

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

Answered by cvgmt on December 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP