Library


Exported functions

TaylorIntegration.taylorintegFunction
taylorinteg(f, x0, t0, tmax, order, abstol, params[=nothing]; kwargs... )

General-purpose Taylor integrator for the explicit ODE $\dot{x}=f(x, p, t)$, where p are the parameters encoded in params. The initial conditions are specified by x0 at time t0; x0 may be of type T<:Number or Vector{T}, with T including TaylorN{T}; the latter case is of interest for jet transport applications.

The equations of motion are specified by the function f; we follow the same convention of DifferentialEquations.jl to define this function, i.e., f(x, p, t) or f!(dx, x, p, t); see the examples below.

The functions returns a TaylorSolution, whose fields are t and x; they represent, respectively, a vector with the values of time (independent variable), and a vector with the computed values of the dependent variable(s). When the keyword argument dense is set to true, it also outputs in the field p the Taylor polynomial expansion computed at each time step. The integration stops when time is larger than tmax, in which case the last returned value(s) correspond to tmax, or when the number of saved steps is larger than maxsteps.

The integration method uses polynomial expansions on the independent variable of order order; the parameter abstol serves to define the time step using the last two Taylor coefficients of the expansions. Make sure you use a large enough order to assure convergence.

Currently, the recognized keyword arguments are:

  • maxsteps[=500]: maximum number of integration steps.
  • parse_eqs[=true]: use the specialized method of jetcoeffs! created with @taylorize.
  • dense[=true]: output the Taylor polynomial expansion at each time step.

Examples

For one dependent variable the function f defines the RHS of the equation of motion, returning the value of $\dot{x}$. The arguments of this function are (x, p, t), where x are the dependent variables, p are the paremeters and t is the independent variable.

For several (two or more) dependent variables, the function f! defines the RHS of the equations of motion, mutating (in-place) the (preallocated) vector with components of $\dot{x}$. The arguments of this function are (dx, x, p, t), where dx is the preallocated vector of $\dot{x}$, x are the dependent variables, p are the paremeters entering the ODEs and t is the independent variable. The function may return this vector or simply nothing.

using TaylorIntegration

f(x, p, t) = x^2

sol = taylorinteg(f, 3, 0.0, 0.3, 25, 1.0e-20, maxsteps=100 )

function f!(dx, x, p, t)
    for i in eachindex(x)
        dx[i] = x[i]^2
    end
    return nothing
end

sol = taylorinteg(f!, [3, 3], 0.0, 0.3, 25, 1.0e-20, maxsteps=100 )

sol = taylorinteg(f!, [3, 3], 0.0, 0.3, 25, 1.0e-20, maxsteps=100, dense=true )
source
TaylorIntegration.taylorinteg!Function
taylorinteg!(dense::Val, f, x0, t0, tmax, abstol, cache, params; kwargs...)
taylorinteg!(dense::Val, f!, q0, t0, tmax, abstol, cache, params; kwargs...)
taylorinteg!(f, x0, trange, abstol, cache, params; kwargs...)
taylorinteg!(f!, q0, trange, abstol, cache, params; kwargs...)
taylorinteg!(dense::Val, f!, g, q0, t0, tmax, abstol, cache, params; kwargs...)
taylorinteg!(f!, g, q0, trange, abstol, cache, params; kwargs...)

Integrate using a preallocated cache, returning a TaylorSolution. This is the in-place, cache-mutating counterpart of taylorinteg; callers that pass the same cache repeatedly can avoid rebuilding the working Taylor polynomials. The last two signatures are the root-finding variants.

The keyword copy_solution controls whether the returned solution owns its storage:

  • copy_solution=Val(true): copy the returned arrays and dense polynomials out of the cache. This is the default for taylorinteg! and is safe when the cache will be reused while earlier solutions are still needed.
  • copy_solution=Val(false): return views or borrowed arrays backed by the cache. This avoids the final solution copy, but the returned solution may be overwritten by later reuse of the same cache.

Use taylorinteg for one-shot runs; it creates a private cache and uses copy_solution=Val(false) internally to minimize allocations.

source
TaylorIntegration.lyap_taylorintegFunction
lyap_taylorinteg(f!, q0, t0, tmax, order, abstol[, jacobianfunc!=nothing];
    maxsteps::Int=500, parse_eqs::Bool=true)
lyap_taylorinteg(f!, q0, trange, order, abstol[, jacobianfunc!=nothing];
    maxsteps::Int=500, parse_eqs::Bool=true)

Similar to taylorinteg for the calculation of the Lyapunov spectrum. Note that the number of TaylorN variables should be set previously by the user (e.g., by means of TaylorSeries.variables!) and should be equal to the length of the vector of initial conditions q0. Otherwise, whenever length(q0) != TaylorSeries.get_numvars(), then lyap_taylorinteg throws an AssertionError. Optionally, the user may provide a Jacobian function jacobianfunc! to evaluate the current value of the Jacobian. Otherwise, the current value of the Jacobian is computed via automatic differentiation using TaylorSeries.jl.

source
TaylorIntegration.@taylorizeMacro

@taylorize expr

This macro evals the function given by expr and defines a new method of jetcoeffs! which is specialized on that function, together with a method of _allocate_jetcoeffs! to improve allocations. Integrating via taylorinteg (or lyap_taylorinteg) after using the macro yields better performance.

See the documentation for more details and limitations.

Warning

This macro is on an experimental stage; check the integration results carefully.

source

Exported types

TaylorIntegration.TaylorSolutionType

TaylorSolution{T, U, N, VT<:AbstractVector{T}, AX<:AbstractArray{U,N}, P<:Union{Nothing, AbstractArray{Taylor1{U}, N}}, VTE<:Union{Nothing, AbstractVector{U}}, AXE<:Union{Nothing, AbstractArray{U, N}}, VΛ<:Union{Nothing, AbstractArray{U,N}}} <: AbstractTaylorSolution{T, U}

This struct represents the return type for taylorinteg. Fields t and x represent, respectively, a vector with the values of time (independent variable), and a vector with the computed values of the dependent variable(s). When taylorinteg is called with dense=true, then field p stores the Taylor polynomial expansion computed at each time step. Fields tevents, xevents and gresids are related to root-finding methods of taylorinteg, while λ is related to the output of lyap_taylorinteg.

source

Internal

TaylorIntegration.BookKeepingType
BookKeeping

Mutable struct that contains all the bookkeeping vectors/dictionaries used within _make_parsed_jetcoeffs: - d_indx : Dictionary mapping new variables (symbols) to old (perhaps indexed) symbols - d_assign : Dictionary with the numeric assignments (that are substituted) - d_decl : Dictionary declared arrays - v_newvars : Symbols of auxiliary indexed vars - v_arraydecl: Symbols which are explicitly declared as Array or Vector - v_array1 : Symbols which are explicitly declared as Array{Taylor1{T},1} - v_array2 : Symbols which are explicitly declared as Array{Taylor1{T},2} - v_array3 : Symbols which are explicitly declared as Array{Taylor1{T},3} - v_array4 : Symbols which are explicitly declared as Array{Taylor1{T},4} - v_preamb : Symbols or Expr used in the preamble (declarations, etc) - retvar : Guessed returned variable, which defines the LHS of the ODEs

source
TaylorIntegration.RetAllocType
RetAlloc{T <: Number}

Struct related to the returned variables that are pre-allocated when @taylorize is used. - v0 : Array{T,1} - v1 : Vector{Array{T,1}} - v2 : Vector{Array{T,2}} - v3 : Vector{Array{T,3}} - v4 : Vector{Array{T,4}}

source
TaylorIntegration.__jetcoeffs!Method
__jetcoeffs!(::Val{false}, f, t, x, params, rv)
__jetcoeffs!(::Val{true}, f, t, x, params, rv)
__jetcoeffs!(::Val{false}, f, t, x, dx, xaux, params, rv)
__jetcoeffs!(::Val{true}, f, t, x, dx, xaux, params, rv)

Chooses a method of jetcoeffs! (hard-coded) or the generated by @taylorize) depending on Val{bool} (bool::Bool).

source
TaylorIntegration._capture_fn_args_body!Function

_capture_fn_args_body!(ex, dd::Dict{Symbol, Any})

Captures the name of a function, arguments, body and other properties, returning them as the values of the dictionary dd, which is updated in place.

source
TaylorIntegration._copy_state!Method
_copy_state!(dest::AbstractVector{U}, src::AbstractVector{U}) where {U<:Number}

Copy src into the reusable state vector dest.

Each element is stored through _store_value!, so compatible Taylor entries are updated in place and incompatible or scalar entries are replaced in the vector slot.

source
TaylorIntegration._copy_value!Method
_copy_value!(dest::Taylor1{U}, src::Taylor1{U}) where {U<:Number}
_copy_value!(dest::TaylorN{U}, src::TaylorN{U}) where {U<:Number}
_copy_value!(dest::T, src::T) where {T<:Number}

Copy src into reusable storage dest when possible and return the stored value.

Matching Taylor1 and TaylorN values with compatible lengths are updated in place with TaylorSeries.identity!, preserving the object already held by the cache. If the Taylor polynomial storage is incompatible, or if the value is an immutable scalar-like number, the method returns a fresh _stored_value instead. Use _store_value! when the caller has an array slot that can be updated directly.

source
TaylorIntegration._defs_allocs!Function

_defs_allocs!(preamble, fnargs, bkkeep, [inloop=false, ex_aux::Expr(:block,)])

Returns a vector with expressions defining the auxiliary variables in the preamble, and the declaration of the arrays. This function may modify bkkeep.d_indx if new variables are introduced. bkkeep.v_preamb is for bookkeeping the introduced variables.

source
TaylorIntegration._determine_parsing!Method
_determine_parsing!(parse_eqs::Bool, f, t, x, params)
_determine_parsing!(parse_eqs::Bool, f, t, x, dx, params)

Check if the parsed method of jetcoeffs! exists and check it runs without error.

source
TaylorIntegration._extract_partsMethod

_extract_parts(ex::Expr)

Returns the function name, the function arguments, and the body of a function passed as an Expr. The function may be provided as a one-line function, or in the long form (anonymous functions do not work).

source
TaylorIntegration._make_parsed_jetcoeffsMethod

_make_parsed_jetcoeffs( ex )

This function constructs the expressions of two new methods, the first equivalent to the differential equations (jetcoeffs!), which exploits the mutating functions of TaylorSeries.jl, and the second one (allocatejetcoeffs) preallocates any auxiliary Taylor1 or Vector{Taylor1{T}} needed.

source
TaylorIntegration._newfnbody!Method

_newfnbody!(fnbody, fnargs, bkkeep)

Returns a new (modified) body of the function, a priori unfolding the expression graph (AST) as unary and binary calls, and updates the bookkeeping structure bkkeep.

source
TaylorIntegration._newheadMethod

_newhead(fn, fnargs)

Creates the head of the new method of jetcoeffs! and _allocate_jetcoeffs, as well as a new in-place method of fn. fn is the name of the passed function and fnargs is a vector with its arguments defning the function (which are either three or four).

source
TaylorIntegration._norminfMethod
_norminf(x::Number)
_norminf(x::Taylor1)
_norminf(x::HomogeneousPolynomial)
_norminf(x::TaylorN)

Return the infinity norm used by the time-step controllers.

For ordinary numbers this delegates to norm(x, Inf). For nested Taylor objects, it recursively takes the maximum infinity norm over all stored coefficients, reducing values such as Taylor1{TaylorN} to a scalar norm.

source
TaylorIntegration._owned_arrayMethod
_owned_array(a::AbstractArray{U}) where {U<:Number}

Return an owned Array copy of a, copying each element with _stored_value. This preserves snapshot semantics for mutable number-like entries such as Taylor1 and TaylorN.

This differs from a shallow array copy because mutable Taylor polynomial entries are copied into independent coefficient storage.

source
TaylorIntegration._parse_newfnbody!Method

parsenewfnbody!(ex::Expr, preex::Expr, prealloc::Expr, bkkeep::BookKeeping, inloop::Bool)

Parses ex (the new body of the function) replacing the expressions to use the mutating functions of TaylorSeries, and building the preamble preex and prealloc expressions. This is done by traversing recursively (again) the args of ex, updating the bookkeeping struct bkkeep, in particular the fieldnames v_newvars and d_assign.

source
TaylorIntegration._preamble_bodyMethod

_preamble_body(fnbody, fnargs)

Returns expressions for the preamble, the declaration of arrays, the body and the bookkeeping struct, which will be used to build the new functions. fnbody is the expression with the body of the original function (already adapted), fnargs is a vector of symbols of the original diferential equations function.

source
TaylorIntegration._rename_indexedvarsMethod

_rename_indexedvars(fnbody)

Renames the indexed variables (using Espresso.genname()) that exists in fnbody. Returns fnbody with the renamed variables and a dictionary that links the new variables to the old indexed ones.

source
TaylorIntegration._replace_expr!Method

_replace_expr!(ex::Expr, preex::Expr, , prealloc::Expr, i::Int, aalhs, aarhs, bkkeep::BookKeeping)

Replaces the calls in ex.args[i], and updates preex and prealloc with the appropriate expressions, based on the the LHS (aalhs) and RHS (aarhs) of the base assignment. The bookkeeping struct is updated (v_newvars) within _replacecalls!. d_indx is used to bring back the indexed variables.

source
TaylorIntegration._replacecalls!Method

_replacecalls!(bkkeep, fnold, newvar)

Replaces the symbols of unary and binary calls of the expression fnold, which defines newvar, by the mutating functions in TaylorSeries.jl. The vector bkkeep.v_vars is updated if new auxiliary variables are introduced (bookkeeping).

source
TaylorIntegration._split_arraydecl!Method

_split_arraydecl!(bkkeep)

Split bkkeep.varraydecl in the vector (bkkeep.varray1), matrix (bkkeep.v_array2), etc, to properly construct the RetAlloc variable.

source
TaylorIntegration._store_state_column!Method
_store_state_column!(
    xv::AbstractMatrix{U},
    nsteps::Int,
    x0::AbstractVector{U},
) where {U<:Number}

Store the state vector x0 in column nsteps of xv. Previously assigned non-isbits entries are reused when possible, so cache reuse does not require allocating new Taylor polynomial objects for every stored state.

The integrator stores vector-valued states internally as variables x steps. For immutable isbits element types, values are assigned directly. For mutable Taylor-valued states, unassigned slots receive independent stored copies and assigned slots are updated in place through _store_value!.

source
TaylorIntegration._store_value!Method
_store_value!(dest::AbstractVector{U}, src::U, i) where {U<:Number}
_store_value!(dest::AbstractMatrix{U}, src::U, i, j) where {U<:Number}

Store src in dest[i] or dest[i, j], reusing an already assigned mutable Taylor slot when possible.

This is the slot-aware wrapper around _copy_value!. If the element type is isbits or the slot has not been assigned yet, a fresh _stored_value is assigned. Otherwise, the existing slot value is updated in place when possible, and replaced only when necessary.

source
TaylorIntegration._stored_event_tupleMethod
_stored_event_tuple(g_tupl::Tuple{Bool,<:Taylor1})

Return an event tuple whose polynomial component is independent of g_tupl. This keeps root-finding state snapshots from aliasing the mutable Taylor polynomials used by the integration cache.

The Boolean crossing-direction flag is immutable and is reused directly. The Taylor polynomial residual is copied through _stored_value.

source
TaylorIntegration._stored_stateMethod
_stored_state(q0::AbstractVector{U}) where {U<:Number}

Return a freshly allocated state vector whose entries are independent stored values copied from q0.

This is used for working initial conditions that may contain mutable Taylor polynomials. It preserves the values from q0 without aliasing the user's input or later cache mutations.

source
TaylorIntegration._stored_valueMethod
_stored_value(x::Taylor1)
_stored_value(x::TaylorN)
_stored_value(x::T) where {T<:Number}

Return a value suitable for storage in solution arrays and integration caches.

Taylor polynomials are copied into fresh coefficient storage with TaylorSeries.identity!, isbits numbers are stored directly, and other Number subtypes fall back to deepcopy. This gives mutable number-like values snapshot semantics while avoiding unnecessary copies for immutable scalar values.

source
TaylorIntegration.build_solutionMethod
build_solution(t, x, p, tevents, xevents, gresids, nsteps, nevents)
build_solution(t, x, tevents, xevents, gresids, nsteps, nevents)
build_solution(copy_solution::Val, t, x, p, tevents, xevents, gresids, nsteps, nevents)
build_solution(copy_solution::Val, t, x, tevents, xevents, gresids, nevents)

Helper function to build a TaylorSolution from a call to a root-finding method of taylorinteg.

When copy_solution is Val(false), the returned solution borrows views of the given arrays. When copy_solution is Val(true), t, x, p, tevents, xevents and gresids are copied into independent owned storage.

The step arrays are trimmed to nsteps, dense-output polynomial arrays are trimmed to nsteps - 1, and event arrays are trimmed to nevents - 1 because nevents is maintained as the next insertion index. Vector state arrays are stored internally as variables x steps and exposed through TaylorSolution as steps x variables.

source
TaylorIntegration.build_solutionMethod
build_solution(t, x, p, nsteps)
build_solution(t, x)
build_solution(copy_solution::Val, t, x, p, nsteps)
build_solution(copy_solution::Val, t, x)

Helper function to build a TaylorSolution from a call to taylorinteg.

When copy_solution is Val(false), the returned solution borrows views of the given arrays. When copy_solution is Val(true), the returned solution owns independent copies of the arrays and Taylor polynomials.

For vector-valued integrations, cache arrays are stored internally as variables x steps; these methods expose them through TaylorSolution as steps x variables. Dense-output polynomial arrays p are trimmed to nsteps - 1, since each dense polynomial represents one completed integration step.

source
TaylorIntegration.findroot!Method
findroot!(t, x, dx, g_tupl_old, g_tupl, eventorder, tvS, xvS, gvS,
    t0, δt_old, x_dx, x_dx_val, g_dg, g_dg_val, nrabstol,
    newtoniter, nevents) -> nevents

Internal root-finding subroutine, based on Newton-Raphson process. If there is a crossing, then the crossing data is stored in tvS, xvS and gvS and nevents, the number of events/crossings, is updated. Here t is a Taylor1 polynomial which represents the independent variable; x is an array of Taylor1 variables which represent the vector of dependent variables; dx is an array of Taylor1 variables which represent the LHS of the ODE; g_tupl_old is the last-before-current value returned by event function g and g_tupl is the current one; eventorder is the order of the derivative of g whose roots the user is interested in finding; tvS stores the surface-crossing instants; xvS stores the value of the solution at each of the crossings; gvS stores the values of the event function g (or its eventorder-th derivative) at each of the crossings; t0 is the current time; δt_old is the last time-step size; x_dx, x_dx_val, g_dg, g_dg_val are auxiliary variables; nrabstol is the Newton-Raphson process tolerance; newtoniter is the maximum allowed number of Newton-Raphson iteration; nevents is the current number of detected events/crossings.

source
TaylorIntegration.init_psolMethod
init_psol(::Val{true}, maxsteps::Int, ::Int, ::Taylor1{U}) where {U<:Number}
init_psol(::Val{true}, maxsteps::Int, dof::Int, ::Array{Taylor1{U},1}) where {U<:Number}
init_psol(::Val{false}, ::Int, ::Int, ::Taylor1{U}) where {U<:Number}
init_psol(::Val{false}, ::Int, ::Int, ::Array{Taylor1{U},1}) where {U<:Number}

Auxiliary function to initialize the dense-output storage psol during a call to taylorinteg.

When the first argument is Val(true), the method allocates the array that will store Taylor polynomials for dense output and later become field :p in TaylorSolution. Scalar integrations use a vector of length maxsteps; vector integrations use a dof x maxsteps matrix. The storage is left uninitialized so set_psol! can populate only the steps that are actually taken. When the first argument is Val(false), the method returns nothing.

source
TaylorIntegration.jetcoeffs!Method
jetcoeffs!(eqsdiff!, t, x, dx, xaux, params)

Mutates x in-place using the recursion relation of the derivatives obtained from the differential equations $\dot{x}=dx/dt=f(x, p, t)$.

eqsdiff! is the function defining the RHS of the ODE, x contains the Taylor1 expansion of the dependent variables and t is the independent variable, and params are the parameters appearing on the function defining the differential equation. See taylorinteg for examples and convention for eqsdiff. Note that x is of type Vector{Taylor1{U}} where U<:Number; t is of type Taylor1{T} where T<:Real. In this case, two auxiliary containers dx and xaux (both of the same type as x) are needed to avoid allocations.

Initially, x contains only the 0-th order Taylor coefficient of the current system state (the initial conditions), and jetcoeffs! computes recursively the high-order derivates back into x.

source
TaylorIntegration.jetcoeffs!Method
jetcoeffs!(eqsdiff, t, x, params)

Returns an updated x using the recursion relation of the derivatives obtained from the differential equations $\dot{x}=dx/dt=f(x, p, t)$.

eqsdiff is the function defining the RHS of the ODE, x contains the Taylor1 expansion of the dependent variable(s) and t is the independent variable, and params are the parameters appearing on the function defining the differential equation. See taylorinteg for examples and convention for eqsdiff. Note that x is of type Taylor1{U} where U<:Number; t is of type Taylor1{T} where T<:Real.

Initially, x contains only the 0-th order Taylor coefficient of the current system state (the initial conditions), and jetcoeffs! computes recursively the high-order derivates back into x.

source
TaylorIntegration.lyap_jetcoeffs!Method
lyap_jetcoeffs!(t, x, dx, jac, varsaux)

Similar to jetcoeffs! for the calculation of the Lyapunov spectrum. Updates only the elements of x which correspond to the solution of the 1st-order variational equations $\dot{\xi}=J \cdot \xi$, where $J$ is the Jacobian matrix, i.e., the linearization of the equations of motion. jac is the Taylor expansion of $J$ wrt the independent variable, around the current initial condition. varsaux is an auxiliary array of type Array{eltype(jac),3} to avoid allocations. Calling this method assumes that jac has been computed previously using stabilitymatrix!.

source
TaylorIntegration.nrconvergencecriterionMethod
nrconvergencecriterion(g_val, nrabstol::T, nriter::Int, newtoniter::Int) where {T<:Real}

A rudimentary convergence criterion for the Newton-Raphson root-finding process. g_val may be either a Real, Taylor1{T} or a TaylorN{T}, where T<:Real. Returns true if: 1) the absolute value of g_val, the value of the event function g evaluated at the current estimated root by the Newton-Raphson process, is less than the nrabstol tolerance; and 2) the number of iterations nriter of the Newton-Raphson process is less than the maximum allowed number of iterations, newtoniter; otherwise, returns false.

source
TaylorIntegration.ownedsolMethod
ownedsol(::Nothing, n::Int)
ownedsol(a, n)
ownedsol(a)

Return an owned solution array copied from a. The two-argument method first selects the first n solution entries with arraysol, then copies them into independent storage.

Use this when a returned TaylorSolution must remain valid after the integration cache is reused.

source
TaylorIntegration.set_psol!Method
set_psol!(::Val{true}, psol::Array{Taylor1{U},1}, nsteps::Int, x::Taylor1{U}) where {U<:Number}
set_psol!(::Val{true}, psol::Array{Taylor1{U},2}, nsteps::Int, x::Vector{Taylor1{U}}) where {U<:Number}
set_psol!(::Val{false}, args...)

Auxiliary function to save Taylor polynomials in a call to taylorinteg.

When the first argument is Val(true), the method stores the current working Taylor polynomial(s) into psol, the dense-output cache backing field :p in TaylorSolution. Scalar integrations store one polynomial per step; vector integrations store one polynomial per component and step. Assigned psol slots are reused in place through _store_value!, so repeated uses of a preallocated cache do not allocate fresh dense polynomials for every stored step. When the first argument is Val(false), the method returns nothing.

See also init_psol.

source
TaylorIntegration.solution_arrayMethod
solution_array(::Val{false}, a, n)
solution_array(::Val{true}, a, n)
solution_array(::Val{false}, a)
solution_array(::Val{true}, a)

Select the array storage used in a returned TaylorSolution. Val(false) returns the borrowed/view-backed storage used by the low-allocation path, while Val(true) returns owned arrays with independent entries.

The three-argument methods first select the active portion of a preallocated cache array; the two-argument methods are used for already-sized time-range solutions.

source
TaylorIntegration.stabilitymatrix!Method
stabilitymatrix!(eqsdiff!, t, x, δx, dδx, jac, dvars, params[, jacobianfunc!=nothing])

Updates the matrix jac::Matrix{Taylor1{U}} (linearized equations of motion) computed from the equations of motion (eqsdiff!), at time t at x; x is of type Vector{Taylor1{U}}, where U<:Number. δx, dδx and dvars are auxiliary arrays of type Vector{TaylorN{Taylor1{U}}} to avoid allocations. Optionally, the user may provide a Jacobian function jacobianfunc! to compute jac. Otherwise, jac is computed via automatic differentiation using TaylorSeries.jl.

source
TaylorIntegration.stepsizeMethod
stepsize(x, epsilon) -> h

Returns a maximum time-step for a the Taylor expansion x using a prescribed absolute tolerance epsilon and the last two Taylor coefficients of (each component of) x.

Note that x is of type Taylor1{U} or Vector{Taylor1{U}}, including also the cases Taylor1{TaylorN{U}} and Vector{Taylor1{TaylorN{U}}}.

Depending of eltype(x), i.e., U<:Number, it may be necessary to overload stepsize, specializing it on the type U, to avoid type instabilities.

source
TaylorIntegration.surfacecrossingMethod
surfacecrossing(g_old, g_now, eventorder::Int)

Detect if the solution crossed a root of event function g. g_old represents the last-before-current value of event function g, and g_now represents the current one; these are Tuple{Bool,Taylor1{T}}s. eventorder is the order of the derivative of the event function g whose root we are trying to find. Returns true if the constant terms of g_old[2] and g_now[2] have different signs (i.e., if one is positive and the other one is negative). Otherwise, if g_old[2] and g_now[2] have the same sign or if the first component of either of them is false, then it returns false.

source
TaylorIntegration.taylorstep!Method
taylorstep!(::Val{false}, f, t, x, abstol, params, rv, parse_eqs=true) -> δt
taylorstep!(::Val{true}, f, t, x, abstol, params, rv, parse_eqs=true) -> δt
taylorstep!(::Val{false}, f!, t, x, dx, xaux, abstol, params, rv, parse_eqs=true) -> δt
taylorstep!(::Val{true}, f!, t, x, dx, xaux, abstol, params, rv, parse_eqs=true) -> δt

One-step Taylor integration for the one-dependent variable ODE $\dot{x}=dx/dt=f(x, p, t)$ with initial conditions $x(t_0)=x_0$. Returns the time-step δt of the actual integration carried out (δt is positive).

Here, f represents the function defining the RHS of the ODE (see taylorinteg), t is the independent variable, x contains the Taylor expansion of the dependent variable, order is the degree used for the Taylor1 polynomials during the integration abstol is the absolute tolerance used to determine the time step of the integration, and params are the parameters entering the ODE functions. For several variables, dx and xaux, both of the same type as x, are needed to save allocations. Finally, parse_eqs is a switch to force not using (parse_eqs=false) the specialized method of jetcoeffs! created with @taylorize; the default is true (parse the equations). Finally, parse_eqs is a switch to force not using (parse_eqs=false) the specialized method of jetcoeffs! created with @taylorize; the default is true (parse the equations). The first argument in the function call Val{bool} (bool::Bool) controls whether a specialized `jetcoeffs! method is being used or not.

source
TaylorIntegration.timeindexMethod
timeindex(sol::TaylorSolution, t::TT) where TT

Return the index of sol.t corresponding to t and the time elapsed from sol.t0 to t.

source
TaylorIntegration.@taylorize2Macro

@taylorize2 expr

This macro generates the internal functions generated by @taylorize producing in addition a new method of the function given in expr which should also improve performance and allocations, whose signature is f(q, params, t, rv::RetAlloc) or f(dq, q, params, t, rv::RetAlloc), which should improve performance and allocations.

See the documentation for more details.

Warning

This macro is on an experimental stage; check the integration results carefully.

source

Index