API Reference#

Complete API reference for all public functions in pyperfectforesight.


Utilities#

pyperfectforesight.v

Time-indexed symbolic variable


Model processing#

pyperfectforesight.process_model

Process model equations and compile to numeric functions

pyperfectforesight.lead_lag_incidence

Detect which variables appear at which time lags in the equations

pyperfectforesight.is_static

Check if an equation contains only current period variables

pyperfectforesight.eliminate_static

Eliminate static variables from dynamic equations

pyperfectforesight.local_blocks

Compute symbolic Jacobian blocks for all lags present in equations


Steady state#

pyperfectforesight.SteadyState

A steady-state solution with full provenance (params and exogenous values).

pyperfectforesight.compile_steady_state_funcs

Compile steady-state residual functions once for repeated use with different parameters.

pyperfectforesight.solve_steady_state

Solve for the steady state using pre-compiled functions.

pyperfectforesight.compute_steady_state_numerical

Compute steady state numerically by solving the system where all time-indexed variables are set to their steady-state values


High-level solvers#

pyperfectforesight.solve_perfect_foresight

Solve the perfect foresight problem using an augmented-path BVP formulation.

pyperfectforesight.solve_perfect_foresight_homotopy

Solve a perfect foresight model using homotopy (parameter continuation).

pyperfectforesight.solve_perfect_foresight_expectation_errors

Solve a perfect foresight model with multiple surprise (MIT) shocks.


Initial guess#

pyperfectforesight.make_initial_guess

Generate an initial guess path for the perfect foresight solver.


Auxiliary variables#

pyperfectforesight.solve_auxiliary_nested

Solve auxiliary equations numerically for a single time period (nested method)

pyperfectforesight.compute_auxiliary_variables

Compute auxiliary variables from dynamic variable solution


Low-level solver components#

pyperfectforesight.residual

Evaluate residuals of the dynamic equations

pyperfectforesight.sparse_jacobian

Build sparse Jacobian matrix using block structure

pyperfectforesight.append_terminal_conditions

Append terminal conditions to enforce convergence to steady state