3
$\begingroup$

I have a two variables system (let say $c$ and $s$ for this variables) and as the system is too complicated to solve analytically, I try to find corresponding values for these two variables numerically.

u[c_] := c^(1 - σ)/(1 - σ)
h[s_] := (2 hbar)/(1 + Exp[η (1 - s/sbar)])
d[s_] := (b s^2)/2

with the following parameters ;

paramFinal = {σ -> 0.55, ρ -> 0.0127, g -> 0.05, sbar -> 95, η -> 3.5, hbar -> 0.01, α -> 0.01, b -> 0.0001, priceadap -> 0.0006,δ -> 0.1, γ -> 2, χ -> 0.025, ϕ -> 0.2, ω -> 0.2, β -> 0.8};

I write the equation from which I try to find the corresponding values for variables $c$ and $s$.

l[c_, s_] := -χ - (ρ + h[s]) + h'[s]/(ρ + h[s]) ((u[c] - d[s])/(u'[c]/β)) + d'[s]/(u'[c]/β)

In order to find these values, I write ;

sol3[i_] := Solve[l[c, i] == 0 /. paramFinal, c]
Table[sol3[i], {i, 0, 10}]

So, until this stage, I have no problem. I can find the corresponding values for $c$ for $s$ on the range between $0$ and $10$

But I can not figure out how to represent these points on a plane $(c,s)$. How can I proceed ? I tried to use ListPlot but it did not work. Any insights or hints are appreciated.

$\endgroup$
4
$\begingroup$
ListLinePlot[Table[{c /. FindRoot[l[c, s] == 0 /. paramFinal, {c, 1}], s}, {s, 0, 30}]]

Mathematica graphics

$\endgroup$
1
$\begingroup$
tab = Table[sol3[i], {i, 0, 10}]

{{{c -> 13.6479}}, {{c -> 13.0982}}, {{c -> 12.5768}}, {{c -> 12.0821}}, {{c -> 11.6123}}, {{c -> 11.1661}}, {{c -> 10.7421}}, {{c -> 10.339}}, {{c -> 9.95566}}, {{c -> 9.59094}}, {{c -> 9.24382}}}

Last /@ Flatten[tab] // ListPlot

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.