# Homotopy

Here is the syntax of the new homotopy mechanism for steady state computation.

The corresponding options in `steady` command are:

`homotopy_mode = 1,2 or 3`(see below)`homotopy_steps = Integer`(sets the number of steps used in the homotopy procedure)

Parameters or exogenous variables (in deterministic models) for which we need to change values are declared in a `homotopy_setup` block.

Each line of this block must use one of the two following syntaxes:

`name, expresssion 1, expression 2``expression 1`must return the initial value (for which it is easy to compute the steady state)`expression 2`must return the desired value for the parameter or exogenous variables.

In this case it is not necessary to initialize

`name`elsewhere (in an`initval`block or in a parameter initialization), since the`homotopy_setup`block provides the necessary initialization.`name, expression`where

`expression`will be the desired value for the parameter or exogenous variable. In this case it is necessary to initialize`name`elsewhere, and this initialization will be used as start value for the homotopy.

Example:

steady(homotopy_mode=1,homotopy_steps=3); homotopy_setup; alpha, 0.3, 0.3^2; psi, 2*0.5; end;

In this example it is necessary to initialize `psi` elsewhere in the mod file, but not `alpha`.

## Homotopy mode 1

In this mode, the distance between the boudaries for each parameter is divided in as many intervals as there are steps and the problem is solved as many times.

## Homotopy mode 2

Same as above, but only one parameter/exogenous is changed at a time. Variables are processed in the order of their declaration in `homotopy_setup`. The problem is solved nbr of parameters/exogenous times nbr of steps times.

## Homotopy mode 3

Dynare tries first the most extreme values. If it fails to compute the steady state, the interval between initial and desired values is divided by two for each parameter. Every time that it is impossible to find a steady state, the previous interval is divided by two. When one succeed to find a steady state, the previous interval is multiplied by two. In that last case `homotopy_steps` contains the maximum number of computations attempted before giving up.