CESFunctions.CESFunctions
— ModuleCESFunctions.jl
Tiny Julia package to implement CES (constant elasticity of substitution) functions, used in economics.
The implementations are themselves trivial, the value added is in testing for type stability and corner cases.
See the module docstring for getting started.
The API
CESFunctions.StaticN
— TypeArgument type with statically known length. Used internally.
CESFunctions.CESProduction
— MethodCESProduction(σ, A)
A constant elasticity of substitution production function of the form
\[Y = (A_1 X_2^{(σ-1)/σ} + A_2 X_2^{(σ-1)/σ} + ...)^{σ/(σ-1)}\]
where $σ$, the elasticity of substitution, is required to be positive.
Alternative parametrizations use a substitution parameter $ρ = (σ - 1)/σ$.
About the type
Fields σ
and A
of the result are part of the public API.
Base.length
can be used to query the length on both values and types.
julia> F = CESProduction(0.1, (0.2, 0.8))
CESProduction{2, Float64}(0.1, (0.2, 0.8))
julia> length(F)
2
julia> length(typeof(F))
2
CESFunctions.input_demands
— Methodinput_demands(F, input_prices, output_quantity)
input_demands(
F,
input_prices,
output_quantity,
output_price
)
Calculate the input demands from input prices (Tuple
or SVector
) and the output quantity. The output_price
can be provided for faster calculations, otherwise is calculated.
CESFunctions.output_price
— Methodoutput_price(F, input_prices)
Calculate the output price from input prices (Tuple
or SVector
).
CESFunctions.output_quantity
— Methodoutput_quantity(F, inputs)
Calculate the output quantity from inputs (Tuple
or SVector
).