I try to solve a list of equation in a following way but it Mathematica solves equations after 30-40 minutes or don't solve them at all. The functions that I use are ;
u[c_] := (c^(1 - σ) - 1)/(1 - σ)
k[m_] := m^α
The equation that I try to solve numerically is ;
r[m_, s_] := pricemit - u'[(χ s + k[m])/β] k'[m]
with the calibration
paramFinal1 = {σ -> 2.1, β -> 0.8, pricemit -> 0.0005, α -> 0.5, χ -> 0.025};
I proceeded in the following two ways but none of them worked ;
sol[i_] := Solve[r[m, i] == 0 /. paramFinal1, m]
Table[sol[i], {i, 1, 15}]
The second way I have tried did not work neither ;
sol11 = Table[r[m, i] /. paramFinal1, {i, 1, 10}]
sol12 = Solve[sol11==0 /.paramFinal1]
These two operations take so much time or put Mathematica on "Running..." status.
How can I express this operations that Mathematica could handle easily ? Any hints, suggestions are appreciated. Thanks in advance.
Edit : When I solve according to $s$ instead of $m$, the system is solved easily but I try to list the corresponding $m$ values for $s$ on a range between 0 and 15 (or some other number instead of 15)
Answer
Perhaps you want this
u[c_] := (c^(1 - σ) - 1)/(1 - σ)
k[m_] := m^α
r[m_, s_] := pricemit - (D[u[c], c] /. c -> (χ s + k[m])/β) D [k[m], m]
paramFinal1 = {σ -> 2.1, β -> 0.8, pricemit -> 0.0005, α -> 0.5, χ -> 0.025};
sol[i_] := FindRoot[r[m, i] == 0 /. paramFinal1, {m, 1}]
Table[sol[i], {i, 15}]
(*
{{m -> 63.437}, {m -> 63.1679}, {m -> 62.8997}, {m -> 62.6323},
{m -> 62.3657}, {m -> 62.1}, {m -> 61.8351}, {m -> 61.5711},
{m -> 61.3079}, {m -> 61.0456}, {m -> 60.7841}, {m -> 60.5234},
{m -> 60.2635}, {m -> 60.0045}, {m -> 59.7463}}
*)
Comments
Post a Comment