FindSteadyStates

Searching generator

FindSteadyStates.ParameterGridType

Grid search iterator for parameters. The sequence of ranges defines the grids to search.

Parameters

  • ParameterGrid: Contain list of ranges. The range is in (start, end, points) order.

Examples

julia> ranges = [ (1.,10.,10.), (1.,10.,10.) ] # list of ranges (start_num, stop_num, number of grids`{int}`)
julia> param_range = ParameterRange(ranges)

julia> ParameterGrid([ [1,1000,5], [1,3,1]]; method=LogGrid())
5-element ParameterGrid:
 [1.0999, 3.0]
 [1.999, 3.0]
 [10.99, 3.0]
 [100.9, 3.0]
 [1000.0, 3.0]
FindSteadyStates.ParameterRandomType

Set all the variables with same method with defined ranges

Parameter Random sampling with range.

Reset one specified method

Meta data of Differential Equations

FindSteadyStates.DEsteadyType
DEsteady(func, p u0, method)
(self::DEsteady)(u0; key=:u0)
  • Struct for solving steady state of an differential equation model.

  • Update steady state meta, and return another DEsteady object.

Argument

  • func: ODE function.
  • u0: initial values
  • p: parameters
  • method: Method for solving steady-states. (i.e. DifferentialEqiations.Tsit5(), DifferentialEquations.AutoTsit5(Rosenbrock23()))

Reference

  1. ODE solvers of DifferentialEquations.jl

Example

julia> using LabelledArrays, DifferentialEqiations
julia> deS = DEsteady(func=x->x, u0= LVector(s1=1.0,s2=2.0), p=1.0)
DEsteady
  func: #17 (function of type var"#17#18")
  p: Float64 1.0
  u0: LArray{Float64,1,Array{Float64,1},(:s1, :s2)}
  method: Tsit5 Tsit5()

julia> deS_new = deS([1000.0,200.0];key=:u0)
DEsteady
  func: #17 (function of type var"#17#18")
  p: Float64 1.0
  u0: LArray{Float64,1,Array{Float64,1},(:s1, :s2)}
  method: Tsit5 Tsit5()

julia> deS_new.u0
2-element LArray{Float64,1,Array{Float64,1},(:s1, :s2)}:
 :s1 => 1000.0
 :s2 => 200.0
FindSteadyStates.ODEtimeType
ODEtime(func, u0, p, tspan)

Struct for solveing time-series of differential-equations. The data type of ode function is referenced to DifferentialEquations.jl.

Argument

  • func: ODE function.
  • u0: initial values
  • p: parameters
  • tspan: time span

References

  1. DifferentialEquations.jl

Reset method

Reset a field of ODEtime struct with broadcast method.

Usage

When using the LabelledArray.jl to define function and subtypes of DEmeta. Use this method to update the values of named arrays without changing the type of the field.

Purpose

This feature is to solve the LabelledArray problem. when using the field vector to define function, the initial values or parameters need to be Named vectors. However, the grid search iterator returns vector which gets error when apply with the funtion of name vector.

!!! compat ModelingToolkit When using 'jacobian', should not use LabelledArray or name tuples for model function.

Arguement

  • u0: should be vector or types that can be broadcast. The length of u0 should be same as ODEtime.u0
  • key: field name of the stuct (default: :u0).

Example

julia> using LabelledArrays, DifferentialEqiations
julia> u = LVector(s1=1.0,s2=0.2)
2-element LArray{Float64,1,Array{Float64,1},(:s1, :s2)}:
 :s1 => 1.0
 :s2 => 0.2

julia> de = ODEtime(func=x->x, u0=u, p=1.0, tspan=(0.0,1.0))
ODEtime
  func: #9 (function of type var"#9#10")
  u0: LArray{Float64,1,Array{Float64,1},(:s1, :s2)}
  p: Float64 1.0
  tspan: Tuple{Float64,Float64}
  method: CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,true,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,true,DefaultLinSolve,DataType},Rational{Int64},Int64}}

julia> de_new = de([1.3,1.4];key=:u0)
ODEtime
  func: #9 (function of type var"#9#10")
  u0: LArray{Float64,1,Array{Float64,1},(:s1, :s2)}
  p: Float64 1.0
  tspan: Tuple{Float64,Float64}
  method: CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,true,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,true,DefaultLinSolve,DataType},Rational{Int64},Int64}}

julia> de_new.u0 # The updated u0 is the struct of LArray
2-element LArray{Float64,1,Array{Float64,1},(:s1, :s2)}:
 :s1 => 1.3
 :s2 => 1.4

julia> de.u0
2-element LArray{Float64,1,Array{Float64,1},(:s1, :s2)}:
 :s1 => 1.0
 :s2 => 0.2

Solvers

The 'solve' function is extended from the DifferentialEquations.solve.

CommonSolve.solveFunction
solve(ode_func::DEsteady, us; ensemble_method=EnsembleThreads())
solve(ode_func::DEsteady) 
solve(ode_func::ODEtime)
solve(ode_func::ODEtime, us; ensemble_method=EnsembleThreads())

Extanded solver for steady state and time-series. The 'DEmeta' type provides the information of differential equations ('func'), initial variables ('u') and parameters ('p'). With DEsteady and 'ODEtime'

Arguements

  • func: DE function
  • us: Vector of vectors of initial variables
  • p: parameter constant

See also

DEsteady, 'ODEtime'

Stability and Jacobian

FindSteadyStates.jacobianType

Construct the jacobian struct type

Argument

  • ode {ODE function}: with the form f(du,u,p,t)
  • u {Array}: initial values
  • p {Array}: parameters

Return

  • Jacobian {struct}

Warning

NameTuple definition of ode function is unrecommended. Due to the incompatibility with ModelingToolkit.modelingtoolkitize

Use DEmeta for jacobian generation

Calculate the jacobian of given initial valuables and parameters.

Get jacobian from state variable with default paramter set

Get jacobian from default state.