# error:Equation number 1 : NaN(The steady state contains NaN or Inf)

**URL:** https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103
**Category:** Steady state
**Created:** [17 January 2019 03:33 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103 "2019-01-17T03:33:39Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Candy](https://forum.dynare.org/user_avatar/forum.dynare.org/candy/32/7374_2.png) [@Candy](https://forum.dynare.org/u/Candy)
#### Post date: [17 January 2019 03:33 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/1 "2019-01-17T03:33:39Z")

</div>

Dear professor and classmates:  
I am a new dynare learner, I met more questions, but i can only deal with a part of the error questions on my own, still have so many questions.  
This question is the all equation is NaN, I alreay check the parameters settings and the equation, maybe it all exists errors, but I cant go through it…

```
Around me ,no teachers and students use dynare, so please help me........

```

Thank you.

[jkwnob.mod](https://forum.dynare.org/uploads/default/original/2X/5/56b58bae5e701e3eefbe17d27bb8204d75875bb3.mod) (3.6 KB)

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [18 January 2019 05:51 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/2 "2019-01-18T05:51:32Z")

</div>

Put  
`resid;`  
before your `steady`-command and then check what is going on in the in the equations that have Inf or large residuals. One problem clearly is that you did not initialize all variables that must not be 0 in your `initval`-block. For example, not setting `p_k` explains the Inf in equation 12 as you are dividing by 0.

---

<div class="post-metadata">

### Author: ![Candy](https://forum.dynare.org/user_avatar/forum.dynare.org/candy/32/7374_2.png) [@Candy](https://forum.dynare.org/u/Candy)
#### Post date: [19 January 2019 07:36 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/3 "2019-01-19T07:36:23Z")

</div>

[jkwnob.mod](https://forum.dynare.org/uploads/default/original/2X/b/b0a0bae6106f1021f8a22ec0cf35f1205c3ebb37.mod) (4.0 KB)

Thank you pro jpfeifer，I am so happy recive your answer, I revise the code, but there still said ‘Impossible to find the steady state’, I dont know why, I use the matlab solve the initval,it equals to the steady state, why didnot have steady state?

So thank you…

---

<div class="post-metadata">

### Author: ![Candy](https://forum.dynare.org/user_avatar/forum.dynare.org/candy/32/7374_2.png) [@Candy](https://forum.dynare.org/u/Candy)
#### Post date: [19 January 2019 08:01 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/4 "2019-01-19T08:01:04Z")

</div>

> [@Candy](#):
>
> Thank you pro jpfeifer，I am so happy recive your answer, I revise the code, but there still said ‘Impossible to find the steady state’, I dont know why, I use the matlab solve the initval,it equals to the steady state, why didnot have steady state?
> 
> So thank you…

Thank you pro jpfeifer，I am so happy recive your answer, I revise the code, but there still said ‘Impossible to find the steady state’, I dont know why, I use the matlab solve the initval,it equals to the steady state, why didnot have steady state?

So thank you…[jkwnob.mod](https://forum.dynare.org/uploads/default/original/2X/b/b0a0bae6106f1021f8a22ec0cf35f1205c3ebb37.mod) (4.0 KB)

---

<div class="post-metadata">

### Author: ![Candy](https://forum.dynare.org/user_avatar/forum.dynare.org/candy/32/7374_2.png) [@Candy](https://forum.dynare.org/u/Candy)
#### Post date: [19 January 2019 08:01 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/5 "2019-01-19T08:01:57Z")

</div>

Thank you pro jpfeifer，I am so happy recive your answer, I revise the code, but there still said ‘Impossible to find the steady state’, I dont know why, I use the matlab solve the initval,it equals to the steady state, why didnot have steady state?

So thank you…[jkwnob.mod](https://forum.dynare.org/uploads/default/original/2X/b/b0a0bae6106f1021f8a22ec0cf35f1205c3ebb37.mod) (4.0 KB)

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [20 January 2019 13:02 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/6 "2019-01-20T13:02:27Z")

</div>

I can only give you generic advice: check what is going on in the in the equations that have large residuals. Often there is still a mistake somewhere in the model. If that does not help, start with a simpler model.

---

<div class="post-metadata">

### Author: ![Candy](https://forum.dynare.org/user_avatar/forum.dynare.org/candy/32/7374_2.png) [@Candy](https://forum.dynare.org/u/Candy)
#### Post date: [21 January 2019 01:16 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/7 "2019-01-21T01:16:07Z")

</div>

Thank you pro jpfeifer， I will check it ，I always think does not all the models could use dynare to solve it？But what kind of models could use it ， I dont know it clearly. In fact, I have some questions about the utility function, I want to know the the utility function just include: consume, money, labor, just this three aspect? Other factor cant in the utility function?

Thank you jpfeifer, sorry for what the questions that maybe so stupid…

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [21 January 2019 12:48 UTC](https://forum.dynare.org/t/error-equation-number-1-nan-the-steady-state-contains-nan-or-inf/13103/8 "2019-01-21T12:48:00Z")

</div>

Sorry, but I don’t understand your last question.
