# Deprecated Functions

This appendix lists currently deprecated functionality along with how to replace it.

Starting in Stan 2.29, deprecated functions with drop in replacements (such as the renaming of `get_lp`

or `multiply_log`

) will be removed 3 versions later e.g., functions deprecated in Stan 2.20 will be removed in Stan 2.23 and placed in Removed Functions. The Stan compiler can automatically update these on the behalf of the user for the entire deprecation window and at least one version following the removal.

## Integer division with `operator/`

*Deprecated*: Using `/`

with two integer arguments is interpreted as integer floor division, such that

\[ 1 / 2 = 0 \]

This is deprecated due to its confusion with real-valued division, where

\[ 1.0 / 2.0 = 0.5 \]

*Replacement*: Use the integer division operator `operator%/%`

instead.

## integrate_ode_rk45, integrate_ode_adams, integrate_ode_bdf ODE Integrators

These ODE integrator functions have been replaced by those described in Ordinary Differential Equation (ODE) Solvers.

### Specifying an ordinary differential equation as a function

A system of ODEs is specified as an ordinary function in Stan within the functions block. The ODE system function must have this function signature:

```
array[] real ode(real time, array[] real state, array[] real theta,
array[] real x_r, array[] int x_i);
```

The ODE system function should return the derivative of the state with respect to time at the time provided. The length of the returned real array must match the length of the state input into the function.

The arguments to this function are:

, the time to evaluate the ODE system`time`

, the state of the ODE system at the time specified`state`

, parameter values used to evaluate the ODE system`theta`

, data values used to evaluate the ODE system`x_r`

, integer data values used to evaluate the ODE system.`x_i`

The ODE system function separates parameter values, * theta*, from data values,

*, for efficiency in computing the gradients of the ODE.*

`x_r`

### Non-stiff solver

`array[,] real`

`integrate_ode_rk45`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, array[] real x_r, array[] int x_i)`

Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method.

*Available since 2.10, deprecated in 2.24*

`array[,] real`

`integrate_ode_rk45`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, array[] real x_r, array[] int x_i, real rel_tol, real abs_tol, int max_num_steps)`

Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method with additional control parameters for the solver.

*Available since 2.10, deprecated in 2.24*

`array[,] real`

`integrate_ode`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, array[] real x_r, array[] int x_i)`

Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method.

*Available since 2.10, deprecated in 2.24*

`array[,] real`

`integrate_ode_adams`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i)`

Solves the ODE system for the times provided using the Adams-Moulton method.

*Available since 2.23, deprecated in 2.24*

`array[,] real`

`integrate_ode_adams`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i, data real rel_tol, data real abs_tol, data int max_num_steps)`

Solves the ODE system for the times provided using the Adams-Moulton method with additional control parameters for the solver.

*Available since 2.23, deprecated in 2.24*

### Stiff solver

`array[,] real`

`integrate_ode_bdf`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i)`

Solves the ODE system for the times provided using the backward differentiation formula (BDF) method.

*Available since 2.10, deprecated in 2.24*

`array[,] real`

`integrate_ode_bdf`

`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i, data real rel_tol, data real abs_tol, data int max_num_steps)`

Solves the ODE system for the times provided using the backward differentiation formula (BDF) method with additional control parameters for the solver.

*Available since 2.10, deprecated in 2.24*

### Arguments to the ODE solvers

The arguments to the ODE solvers in both the stiff and non-stiff cases are as follows.

: function literal referring to a function specifying the system of differential equations with signature:`ode`

`(real, array[] real, array[] real, data array[] real, data array[] int):array[] real`

The arguments represent (1) time, (2) system state, (3) parameters, (4) real data, and (5) integer data, and the return value contains the derivatives with respect to time of the state,

: initial state, type`initial_state`

`array[] real`

,: initial time, type`initial_time`

`int`

or`real`

,: solution times, type`times`

`array[] real`

,: parameters, type`theta`

`array[] real`

,`data`

: real data, type`x_r`

`array[] real`

, data only, and`data`

: integer data, type`x_i`

`array[] int`

, data only.

For more fine-grained control of the ODE solvers, these parameters can also be provided:

`data`

: relative tolerance for the ODE solver, type`rel_tol`

`real`

, data only,`data`

: absolute tolerance for the ODE solver, type`abs_tol`

`real`

, data only, and`data`

: maximum number of steps to take in the ODE solver, type`max_num_steps`

`int`

, data only.

#### Return values

The return value for the ODE solvers is an array of type `array[,] real`

, with values consisting of solutions at the specified times.

#### Sizes and parallel arrays

The sizes must match, and in particular, the following groups are of the same size:

state variables passed into the system function, derivatives returned by the system function, initial state passed into the solver, and rows of the return value of the solver,

solution times and number of rows of the return value of the solver,

parameters, real data and integer data passed to the solver will be passed to the system function

## algebra_solver, algebra_solver_newton algebraic solvers

These algebraic solver functions have been replaced by those described in Algebraic Equation Solvers..

### Specifying an algebraic equation as a function

An algebraic system is specified as an ordinary function in Stan within the function block. The algebraic system function must have this signature:

```
vector algebra_system(vector y, vector theta,
data array[] real x_r, array[] int x_i)
```

The algebraic system function should return the value of the algebraic function which goes to 0, when we plug in the solution to the algebraic system.

The argument of this function are:

, the unknowns we wish to solve for`y`

, parameter values used to evaluate the algebraic system`theta`

, data values used to evaluate the algebraic system`x_r`

, integer data used to evaluate the algebraic system`x_i`

The algebraic system function separates parameter values, * theta*, from data values,

*, for efficiency in propagating the derivatives through the algebraic system.*

`x_r`

### Call to the algebraic solver

`vector`

`algebra_solver`

`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i)`

Solves the algebraic system, given an initial guess, using the Powell hybrid algorithm.

*Available since 2.17, deprecated in 2.31*

`vector`

`algebra_solver`

`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i, data real rel_tol, data real f_tol, int max_steps)`

Solves the algebraic system, given an initial guess, using the Powell hybrid algorithm with additional control parameters for the solver.

*Available since 2.17, deprecated in 2.31*

*Note:* In future releases, the function `algebra_solver`

will be deprecated and replaced with `algebra_solver_powell`

.

`vector`

`algebra_solver_newton`

`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i)`

Solves the algebraic system, given an initial guess, using Newton’s method.

*Available since 2.24, deprecated in 2.31*

`vector`

`algebra_solver_newton`

`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i, data real rel_tol, data real f_tol, int max_steps)`

Solves the algebraic system, given an initial guess, using Newton’s method with additional control parameters for the solver.

*Available since 2.24, deprecated in 2.31*

#### Arguments to the algebraic solver

The arguments to the algebraic solvers are as follows:

: function literal referring to a function specifying the system of algebraic equations with signature`algebra_system`

`(vector, vector, array[] real, array[] int):vector`

. The arguments represent (1) unknowns, (2) parameters, (3) real data, and (4) integer data, and the return value contains the value of the algebraic function, which goes to 0 when we plug in the solution to the algebraic system,: initial guess for the solution, type`y_guess`

`vector`

,: parameters only, type`theta`

`vector`

,: real data only, type`x_r`

`array[] real`

, and: integer data only, type`x_i`

`array[] int`

.

For more fine-grained control of the algebraic solver, these parameters can also be provided:

: relative tolerance for the algebraic solver, type`rel_tol`

`real`

, data only,: function tolerance for the algebraic solver, type`function_tol`

`real`

, data only,: maximum number of steps to take in the algebraic solver, type`max_num_steps`

`int`

, data only.

#### Return value

The return value for the algebraic solver is an object of type `vector`

, with values which, when plugged in as `y`

make the algebraic function go to 0.

#### Sizes and parallel arrays

Certain sizes have to be consistent. The initial guess, return value of the solver, and return value of the algebraic function must all be the same size.

The parameters, real data, and integer data will be passed from the solver directly to the system function.