Pound lines again


I have 12 pound lines at the top of a model section, and 70 variables/equations. The _static.m file initializes g1 matrix as 70x70, but starts writing at only 13th line, and references 82nd line. This produces a Matlab error.

It seems, that the number of pound lines is not subtracted from an equation index when writing g1 matrix. Forming residual is correct.

thanks for considering this bug report


Ondra K.

Thanks Ondra,

I will correct it in the next days.



I believe that the bug with the pound sign (#) instructions is now corrected. It is checked in SVN and should be available in tomorrow snapshot for version 4.



Dear Michel,

the problem with the pound (#) sign in Dynare 4 seems to persist. I use revision 1008, which was posted at the end of October.

I get the following error message (in a window):
dynare_m.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

And in the Matlab command window it says:
**??? Undefined function or variable ‘ireland_loglin’.

Error in ==> dynare at 49
evalin(‘base’,fname) ;**

The model works fine in Dynare 3 and also in Dynare 4 if I omit the lines with # sign (auxiliary parameters) in the model declaration.

Kind regards,


Dear Christophe,

can you please post the *.mod file?



The file is attached now.

This is a (log-)linearized version of the Ireland model. It works fine in Dynare 3 but the pound lines cause problems in Dynare 4.

On my PC the nonlinear test files ireland.mod and ireland1.mod included in the SVN versions of Dynare 3 and 4 do not work because Dynare is unable to solve for the steady state (convergence problems).

Many thanks,

ireland_loglin.mod (852 Bytes)

Can you update again? The current SVN version is working for me.
Are you recompiling for Max OS/X or are you using the provided matlab/dynare_m.exe ?



I have downloaded the latest version. Yet, the problems are the same. I still get the error messages I copied into my first message when I run ireland_loglin.mod.

Also the nonlinear example files still do not work, again because of convergence problems in the calculation of the steady state.

I am not sure I understand your last question. I would guess I am using matlab\dynare_m.exe.


The error message that you indicated means that the parser that makes *.m files from your *.mod files fails to execute. This program is matlab/dynare_m.exe

Are you updating via SVN (using cygwin or Tortoise) or are you downloading the snapshot for Dynare v4?
If it is the later, my last changes will only be available tomorrow.

I am unable to reproduce the problem that you are encountering. Please, do the following in Matlab:

which dynare

does the answer points correctly to the latest version that you downloaded?
does dynare_m.exe is dated November 7 and has 1 081 825 bytes?

Which version of Windows are you using?

Kind regards


Thanks a lot, Michel.

I installed SVN revision 1048 and now ireland_loglin.mod works fine with the pound lines, while with yesterday’s snapshot version it did not work.

One last question:
Do the test files ireland.mod and ireland1.mod included in the dynare folders …\tests\pi2004 work fine on your PC? On mine, regardless of the dynare 4 version I use, I get the following error message:

**SOLVE: maxit has been reached
??? Error using ==> steady_
STEADY: convergence problems

Error in ==> steady at 13

Error in ==> ireland1 at 189

Error in ==> dynare at 49
evalin(‘base’,fname) ;**

Many thanks,


I am working on a log-linearized model where steady-state values of the endogenous variables show up in the model declaration step. My model is such that some of these steady-state values need to be solved using a numerical solver.

It appears that Dynare 4 does not like functions beyond the standard addition, subtraction, log, square root, etc., so calling a function I wrote to compute the steady-state values is out of question. For instance, add

blah = max([1,3,5]);

to your model step you would see that Dynare does not like it.

Has anyone here experienced the same or a similar issue? Any suggestion or ideas on how to get around this would be greatly appreciated!

Thanks in advance for your time!


In Dynare v4, the set of authorized functions inside the model block is limited to standard functions (arithmetic operators, sqrt, log, exp, trigonometry…). This is due to the fact that in Dynare v4 we compute analytical derivatives of the model, while in Dynare v3 we were only computing numerical derivatives. Therefore, we need to know the analytical derivative of any function used in the model block.

In future releases of Dynare, we will introduce the possibility of using arbitrary functions in the model block by allowing the user to provide its first (and possibly second) derivatives.

Also note that there already exist a “max” function, but which only accepts two arguments. In your case you could write:

blah = max(a, max(b, c));



I see. Thank you for the response!