### MTKParameters Structure Example Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Illustrates the structure of `MTKParameters` after a buffer recreation. This example shows the resulting parameter values and internal data types, specifically highlighting `Float32` and `Float64`. ```Julia ModelingToolkit.MTKParameters{Vector{Float32}, Vector{Float64}, Tuple{}, Tuple{}, Tuple{}, Tuple{}}(Float32[2.0, 3.0, 1.0], [0.0, 0.0, 1.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0], (), (), (), ()) ``` -------------------------------- ### Install SymbolicIndexingInterface.jl Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/index This code snippet demonstrates how to install the SymbolicIndexingInterface.jl package using the Julia package manager. It ensures that the necessary tools for symbolic indexing are available in your Julia environment. ```Julia using Pkg Pkg.add("SymbolicIndexingInterface") ``` -------------------------------- ### ExampleIntegrator with ParameterIndexingProxy Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii Demonstrates how to use `ParameterIndexingProxy` to provide a cleaner interface for getting and setting parameter values in an `ExampleIntegrator`. It overrides `getproperty` to return a proxy for the `:ps` symbol. ```Julia function Base.getproperty(obj::ExampleIntegrator, sym::Symbol) if sym === :ps return ParameterIndexingProxy(obj) else return getfield(obj, sym) end end ``` -------------------------------- ### Create Example Solution Object with Timeseries Parameters Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii Constructs an `ExampleSolution2` object, which includes a `SymbolCache` defining parameters and their timeseries associations. It demonstrates how to set up parameters that are part of the same or different timeseries. ```Julia sys = SymbolCache( [:x, :y, :z], [:a, :b, :c, :d], :t; # specify that :b, :c and :d are timeseries parameters # :b and :c belong to the same timeseries # :d is in a different timeseries timeseries_parameters = Dict( :b => ParameterTimeseriesIndex(1, 1), :c => ParameterTimeseriesIndex(1, 2), :d => ParameterTimeseriesIndex(2, 1), )) b_c_timeseries = MyDiffEqArray( collect(0.0:0.1:1.0), [[0.25i, 0.35i] for i in 1:11] ) d_timeseries = MyDiffEqArray( collect(0.0:0.2:1.0), [[0.17i] for i in 1:6] ) p = MyParameterObject( # parameter values at the final time [4.2, b_c_timeseries.u[end]..., d_timeseries.u[end]...], [[2, 3], [4]] ) sol = ExampleSolution2( sys, [i * ones(3) for i in 1:5], # u collect(0.0:0.25:1.0), # t p, ParameterTimeseriesCollection([b_c_timeseries, d_timeseries], deepcopy(p)) ) ``` -------------------------------- ### Plotting Solutions Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Provides an example of plotting a solution using the `plot` function with specified indices. ```Julia plot(sol, idxs=x) ``` -------------------------------- ### Simple Demonstration of a Symbolic System Structure Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Provides a basic example illustrating how a symbolic system, potentially defined using a domain-specific language, can be represented and interacted with via the SciML symbolic indexing interface. ```Julia using ModelingToolkit using SciMLBase # Define a simple symbolic system using ModelingToolkit @variables x y @parameters a b # Create a system (e.g., ODE system) # eqs = [D(x) ~ a*x - b*x*y, D(y) ~ -y + x*y] # sys =ODESystem(eqs, t, [x, y], [a, b]) # Assume 'sys' or a related structure implements the interface # Example: Accessing a variable symbolically # var_x = sys.x # Example: Accessing a parameter symbolically # param_a = sys.a ``` -------------------------------- ### Implementing the Complete Symbolic Indexing Interface Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Guides users on how to implement the full symbolic indexing interface for their custom data types or domain-specific languages. This ensures seamless integration with the SciML ecosystem. ```Julia using SciMLBase # Define a custom type # struct MyCustomSolution{T, P} # u::Vector{T} # p::P # t::Float64 # end # Implement the necessary interface functions # Base.getindex(sol::MyCustomSolution, i::Int) = sol.u[i] # Base.setindex!(sol::MyCustomSolution, val, i::Int) = sol.u[i] = val # Base.getindex(sol::MyCustomSolution, ::Val{:p}) = sol.p # Base.setindex!(sol::MyCustomSolution, val, ::Val{:p}) = sol.p = val # Ensure other required functions like `similar`, `size`, etc., are implemented ``` -------------------------------- ### Parameter Timeseries Implementation Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii Provides a detailed example of implementing parameter timeseries functionality using `SymbolicIndexingInterface`. It includes custom types `MyParameterObject` and `ExampleSolution2`, along with the necessary interface methods for parameter value access, updates, and timeseries identification. ```Julia using SymbolicIndexingInterface # First, we must implement a parameter object that knows where the parameters in # each parameter timeseries are stored struct MyParameterObject p::Vector{Float64} disc_idxs::Vector{Vector{Int}} end # To be able to access parameter values SymbolicIndexingInterface.parameter_values(mpo::MyParameterObject) = mpo.p # Update the parameter object with new values # Here, we don't need the index provider but it may be necessary for other implementations function SymbolicIndexingInterface.with_updated_parameter_timeseries_values( ::SymbolCache, mpo::MyParameterObject, args::Pair...) for (ts_idx, val) in args mpo.p[mpo.disc_idxs[ts_idx]] = val end return mpo end struct ExampleSolution2 sys::SymbolCache u::Vector{Vector{Float64}} t::Vector{Float64} p::MyParameterObject # the parameter object. Only some parameters are timeseries params p_ts::ParameterTimeseriesCollection end # Add the `:ps` property to automatically wrap in `ParameterIndexingProxy` function Base.getproperty(fs::ExampleSolution2, s::Symbol) s === :ps ? ParameterIndexingProxy(fs) : getfield(fs, s) end # Use the contained `SymbolCache` for indexing SymbolicIndexingInterface.symbolic_container(fs::ExampleSolution2) = fs.sys # State indexing methods SymbolicIndexingInterface.state_values(fs::ExampleSolution2) = fs.u SymbolicIndexingInterface.current_time(fs::ExampleSolution2) = fs.t # By default, `parameter_values` refers to the last value SymbolicIndexingInterface.parameter_values(fs::ExampleSolution2) = fs.p SymbolicIndexingInterface.get_parameter_timeseries_collection(fs::ExampleSolution2) = fs.p_ts # Mark the object as a timeseries object SymbolicIndexingInterface.is_timeseries(::Type{ExampleSolution2}) = Timeseries() # Mark the object as a parameter timeseries object SymbolicIndexingInterface.is_parameter_timeseries(::Type{ExampleSolution2}) = Timeseries() ``` -------------------------------- ### Get Parameter Value Symbolically from Solution in Julia Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/simple_sii_sys Shows how to retrieve a function that gets a specific parameter (e.g., `:k₁`) from the solved `ODEProblem`'s solution. This function can be called with the solution object to get the parameter's value as it was used in the solve. ```Julia getk1(sol) ``` -------------------------------- ### Parameter Indexing: Getting and Setting Parameter Values Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Demonstrates how the symbolic indexing interface facilitates the retrieval and modification of parameter values within SciML problem or solution objects. This is crucial for tasks like sensitivity analysis and parameter estimation. ```Julia using SciMLBase # Assume 'prob' is a problem object with parameters 'p' # Example: Getting a parameter value # param_val = prob.p[1] # Example: Setting a parameter value # prob.p[1] = new_param_val # This interface allows for symbolic access, e.g., prob.p.k1 ``` -------------------------------- ### Get Parameter Value Symbolically from Problem in Julia Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/simple_sii_sys Demonstrates how to retrieve a function that gets a specific parameter (e.g., `:k₁`) from the `ODEProblem` using the `SymbolCache`. This function can then be called with the problem to get the parameter's value. ```Julia getk1 = getp(sys, :k₁) getk1(prob) ``` -------------------------------- ### Get Parameter Values Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Retrieves an indexable collection of parameter values from a value provider. Supports accessing a specific parameter by index. ```Julia parameter_values(valp) parameter_values(valp, i) ``` -------------------------------- ### SymbolicIndexingInterface: Get all parameter symbols Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `parameter_symbols` function returns a vector of all symbolic parameters associated with the index provider `indp`. This list is crucial for understanding the fixed inputs of a system. ```Julia parameter_symbols(indp) ``` -------------------------------- ### Get Associated Systems with BatchedInterface Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Retrieves the indices of the index providers associated with each symbol in a BatchedInterface. The output array corresponds to the order of symbols returned by variable_symbols(bi). ```Julia associated_systems(bi::BatchedInterface) ``` -------------------------------- ### Get Observed Variables from ODESystem in Julia Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage This code snippet demonstrates how to retrieve the observed variables defined within an ODESystem using ModelingToolkit. ```Julia ModelingToolkit.observed(sys) ``` -------------------------------- ### Get Parameter Timeseries Collection (Julia) Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Retrieves the `ParameterTimeseriesCollection` from a value provider that supports timeseries. This function is only valid for value providers where `is_parameter_timeseries` returns `Timeseries`. ```Julia get_parameter_timeseries_collection(valp) ``` -------------------------------- ### Get Multiple Parameter Values Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Illustrates how to retrieve values for multiple parameters (e.g., 'σ' and 'ρ') simultaneously using `getp`. The getter function returns a tuple containing the values of the requested parameters in the specified order. ```Julia using SymbolicIndexingInterface using ModelingToolkit # Assume 'sys' is a symbolic system and 'sol' is a solution object # Assume 'σ' and 'ρ' are parameter symbols # Get the getter function for parameters 'σ' and 'ρ' σ_ρ_getter = getp(sys, (σ, ρ)) # Retrieve the values of 'σ' and 'ρ' using the getter # σ_ρ_getter(sol) ``` -------------------------------- ### SymbolicIndexingInterface: Get all symbols Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `all_symbols` function returns an array containing all symbols present in the index provider, encompassing parameters and independent variables. This offers a complete view of all symbolic elements. ```Julia all_symbols(indp) ``` -------------------------------- ### Get History Function for Value Provider Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Retrieves the history function for a given value provider. This is necessary for value providers associated with index providers that are not Markovian. ```Julia get_history_function(valp) ``` -------------------------------- ### SymbolicIndexingInterface: Get default values Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `default_values` function returns a mutable dictionary that maps symbols in the index provider to their default values. This is useful for initializing parameters or variables. ```Julia default_values(indp) ``` -------------------------------- ### Get Single Parameter Value Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Shows how to retrieve the value of a specific parameter (e.g., 'σ') from a system using `getp`. The returned getter function can be applied to the solution or problem object to obtain the parameter's value. ```Julia using SymbolicIndexingInterface using ModelingToolkit # Assume 'sys' is a symbolic system and 'sol' is a solution object # Assume 'σ' is a parameter symbol # Get the getter function for parameter 'σ' σ_getter = getp(sys, σ) # Retrieve the value of 'σ' using the getter # σ_getter(sol) # or σ_getter(prob) ``` -------------------------------- ### SymbolicIndexingInterface: Get all variable symbols (including observed) Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `all_variable_symbols` function returns a vector of all variable symbols in the system, including those that are observed. It provides a comprehensive list of all quantities that can be indexed. ```Julia all_variable_symbols(indp) ``` -------------------------------- ### SymbolicIndexingInterface: Get symbolic container Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The optional `symbolic_container` function returns an object that implements the index provider interface, using the provided `indp`. This is useful for creating trivial implementations that forward calls to another object. ```Julia symbolic_container(indp) ``` -------------------------------- ### Get Parameter Function Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Returns a function to retrieve a parameter's value based on its symbol. Handles single parameters, arrays of parameters, and timeseries parameters, with specific behaviors for each case. ```Julia getp(indp, sym) ``` -------------------------------- ### SymbolicIndexingInterface: Get all variable symbols Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `variable_symbols` function retrieves a vector containing all symbolic variables that are currently being solved for in the index provider `indp`. For time-dependent systems, an optional time index `i` can be specified. ```Julia variable_symbols(indp, [i]) ``` -------------------------------- ### SymbolicIndexingInterface: Get the index of a parameter Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `parameter_index` function returns the numerical index for a specified parameter symbol `sym` within the index provider `indp`. It returns `nothing` if the symbol is not found as a parameter. ```Julia parameter_index(indp, sym) ``` -------------------------------- ### Implement parameter_values for ExampleSystem Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii This code snippet shows how to implement the `parameter_values` function for a custom type `ExampleSystem`. This function is crucial for the default `getp` and `setp` methods to work correctly, allowing access to the system's parameter values. ```Julia function SymbolicIndexingInterface.parameter_values(sys::ExampleSystem) sys.p end ``` -------------------------------- ### Define ExampleSystem for Symbolic Indexing Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii This code defines a basic `ExampleSystem` struct in Julia, intended to demonstrate the implementation of the Symbolic Indexing Interface. It includes dictionaries for state and parameter indexing, a field for the independent variable, default values, and a mapping for observed variables. ```Julia using SymbolicIndexingInterface struct ExampleSystem state_index::Dict{Symbol,Int} parameter_index::Dict{Symbol,Int} independent_variable::Union{Symbol,Nothing} defaults::Dict{Symbol, Float64} # mapping from observed variable to Expr to calculate its value observed::Dict{Symbol,Expr} end ``` -------------------------------- ### Get Symbolic Variable Name Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The getname function returns the name of a symbolic variable as a Symbol. For Symbol types, it acts as an identity function. ```Julia getname(x)::Symbol ``` -------------------------------- ### Set All Parameter Values Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Explains how to set all parameter values at once using `setp` with a list of parameter symbols and their corresponding values. The order of values must match the order of symbols provided. ```Julia using SymbolicIndexingInterface using ModelingToolkit # Assume 'prob' is a problem object and 'parameter_symbols(prob)' returns the symbols # Get the setter function for all parameters all_param_setter = setp(prob, parameter_symbols(prob)) # Set all parameter values (ensure order matches symbols) # all_param_setter(prob, [29.0, 11.0, 2.5]) ``` -------------------------------- ### Get Symbolic Type of a Variable Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The symbolic_type function retrieves the symbolic trait of a given type or variable. It defaults to NotSymbolic, but recognizes Symbol and Expr as ScalarSymbolic. ```Julia symbolic_type(x) = symbolic_type(typeof(x)) symbolic_type(::Type) ``` -------------------------------- ### ExampleSolution Timeseries Interface Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii This code defines the SymbolicIndexingInterface methods for `ExampleSolution`, enabling it to handle timeseries data. It implements `symbolic_container`, `parameter_values`, `state_values`, and `current_time`, and marks the type as a timeseries using `is_timeseries`. ```Julia struct ExampleSolution u::Vector{Vector{Float64}} t::Vector{Float64} p::Vector{Float64} sys::ExampleSystem end # define a fallback for the interface methods SymbolicIndexingInterface.symbolic_container(sol::ExampleSolution) = sol.sys SymbolicIndexingInterface.parameter_values(sol::ExampleSolution) = sol.p # define the trait SymbolicIndexingInterface.is_timeseries(::Type{ExampleSolution}) = Timeseries() # both state_values and current_time return a timeseries, which must be # the same length SymbolicIndexingInterface.state_values(sol::ExampleSolution) = sol.u SymbolicIndexingInterface.current_time(sol::ExampleSolution) = sol.t ``` -------------------------------- ### Solve ODESystem and Prepare Solution in Julia Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage This code sets up and solves an Ordinary Differential Equation (ODE) system using Julia's OrdinaryDiffEq and ModelingToolkit. It defines initial conditions, parameters, time span, and then solves the problem. ```Julia u0 = [D(x) => 2.0, x => 1.0, y => 0.0, z => 0.0] p = [σ => 28.0, ρ => 10.0, β => 8 / 3] tspan = (0.0, 100.0) prob = ODEProblem(sys, u0, tspan, p, jac = true) sol = solve(prob, Tsit5()) ``` -------------------------------- ### Indexing Solution with a Single Value and Indices Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Demonstrates indexing a solution with a single value and a list of indices. ```Julia sol(1.3, idxs=x) ``` -------------------------------- ### Julia Environment and System Information Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/index Details the Julia version, build information, and platform specifics including the operating system, CPU architecture, and LLVM version used during the documentation build process. ```Julia Julia Version 1.11.6 Commit 9615af0f269 (2025-07-09 12:58 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 4 × AMD EPYC 7763 64-Core Processor WORD_SIZE: 64 LLVM: libLLVM-16.0.6 (ORCJIT, znver3) Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores) ``` -------------------------------- ### Show Parameters Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Displays parameter information for a `ParameterIndexingProxy`. Allows customization of the number of rows, whether to show all parameters, and scalarization. ```Julia show_params(io::IO, pip::ParameterIndexingProxy; num_rows = 20, show_all = false, scalarize = true, kwargs...) ``` -------------------------------- ### Indexing Solution with a Single Value and Symbol Indices Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Shows how to index a solution with a single value and a list of symbol indices. ```Julia sol(1.3, idxs=[:y, :z]) ``` -------------------------------- ### Indexing Solution with a Single Symbol Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Shows how to index a solution with a single symbol to retrieve its corresponding values. ```Julia sol[(t, w)] ``` -------------------------------- ### SymbolicIndexingInterface: Get all independent variable symbols Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `independent_variable_symbols` function returns a vector of all symbolic independent variables managed by the index provider `indp`. This includes variables like time, if applicable. ```Julia independent_variable_symbols(indp) ``` -------------------------------- ### Indexing Solution with a Single Value and Multiple Indices Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Illustrates indexing a solution with a single value and an array of indices. ```Julia sol(1.3, idxs=[x, w]) ``` -------------------------------- ### Full Manifest Dependencies for SymbolicIndexingInterface.jl Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/index Provides a comprehensive list of all dependencies and their versions for the SymbolicIndexingInterface.jl package, as recorded in the Manifest.toml file. This includes a wide range of packages used in the Julia ecosystem. ```Julia Status `~/work/SymbolicIndexingInterface.jl/SymbolicIndexingInterface.jl/docs/Manifest.toml` [47edcb42] ADTypes v1.16.0 [a4c015fc] ANSIColoredPrinters v0.0.1 [1520ce14] AbstractTrees v0.4.5 [7d9f7c33] Accessors v0.1.42 [79e6a3ab] Adapt v4.3.0 [66dad0bd] AliasTables v1.1.3 [ec485272] ArnoldiMethod v0.4.0 [4fba245c] ArrayInterface v7.19.0 [4c555306] ArrayLayouts v1.11.2 [e2ed5e7c] Bijections v0.2.2 [d1d4a3ce] BitFlags v0.1.9 [62783981] BitTwiddlingConvenienceFunctions v0.1.6 [8e7c35d0] BlockArrays v1.7.0 [70df07ce] BracketingNonlinearSolve v1.3.0 [2a0fbf3d] CPUSummary v0.2.7 [d360d2e6] ChainRulesCore v1.26.0 [fb6a15b2] CloseOpenIntervals v0.1.13 [944b1d66] CodecZlib v0.7.8 [35d6a980] ColorSchemes v3.30.0 [3da002f7] ColorTypes v0.12.1 [c3611d14] ColorVectorSpace v0.11.0 [5ae59095] Colors v0.13.1 [861a8166] Combinatorics v1.0.3 [a80b9123] CommonMark v0.9.1 [38540f10] CommonSolve v0.2.4 [bbf7d656] CommonSubexpressions v0.3.1 [f70d9fcc] CommonWorldInvalidations v1.0.0 [34da2185] Compat v4.18.0 [b152e2b5] CompositeTypes v0.1.4 [a33af91c] CompositionsBase v0.1.2 [2569d6c7] ConcreteStructs v0.2.3 [f0e56b4a] ConcurrentUtilities v2.5.0 [187b0558] ConstructionBase v1.6.0 [d38c429a] Contour v0.6.3 [adafc99b] CpuId v0.3.1 [9a962f9c] DataAPI v1.16.0 [864edb3b] DataStructures v0.18.22 [8bb1440f] DelimitedFiles v1.9.1 [2b5f629d] DiffEqBase v6.183.0 [459566f4] DiffEqCallbacks v4.9.0 [77a26b50] DiffEqNoiseProcess v5.24.1 [163ba53b] DiffResults v1.1.0 [b552c78f] DiffRules v1.15.1 [a0c0ee7d] DifferentiationInterface v0.7.4 [8d63f2c5] DispatchDoctor v0.4.26 [31c24e10] Distributions v0.25.120 [ffbed154] DocStringExtensions v0.9.5 [e30172f5] Documenter v1.14.1 [5b8099bc] DomainSets v0.7.16 [7c1d4256] DynamicPolynomials v0.6.2 [06fc5a27] DynamicQuantities v1.8.0 [4e289a0a] EnumX v1.0.5 [f151be2c] EnzymeCore v0.8.12 [460bff9d] ExceptionUnwrapping v0.1.11 [d4d017d3] ExponentialUtilities v1.27.0 [e2ba6199] ExprTools v0.1.10 [55351af7] ExproniconLite v0.10.14 [c87230d0] FFMPEG v0.4.4 [7034ab61] FastBroadcast v0.3.5 [9aa1b823] FastClosures v0.3.2 [442a2c76] FastGaussQuadrature v1.0.2 [a4df4552] FastPower v1.1.3 [1a297f60] FillArrays v1.13.0 [64ca27bc] FindFirstFunctions v1.4.1 [6a86dc24] FiniteDiff v2.27.0 [53c48c17] FixedPointNumbers v0.8.5 [1fa38f19] Format v1.3.7 [f6369f11] ForwardDiff v1.0.1 [069b7b12] FunctionWrappers v1.1.3 [77dc65aa] FunctionWrappersWrappers v0.1.3 [d9f16b24] Functors v0.5.2 [46192b85] GPUArraysCore v0.2.0 [28b8d3ca] GR v0.73.17 [c145ed77] GenericSchur v0.5.5 [d7ba0133] Git v1.4.0 [c27321d9] Glob v1.3.1 [86223c79] Graphs v1.13.0 [42e2da0e] Grisu v1.0.2 [cd3eb016] HTTP v1.10.17 [34004b35] HypergeometricFunctions v0.3.28 [b5f81e59] IOCapture v0.2.5 [615f187c] IfElse v0.1.1 [3263718b] ImplicitDiscreteSolve v1.2.0 [d25df0c9] Inflate v0.1.5 [18e54dd8] IntegerMathUtils v0.1.3 [8197267c] IntervalSets v0.7.11 [3587e190] InverseFunctions v0.1.17 [92d709cd] IrrationalConstants v0.2.4 [82899510] IteratorInterfaceExtensions v1.0.0 [1019f520] JLFzf v0.1.11 [692b3bcd] JLLWrappers v1.7.1 [682c06a0] JSON v0.21.4 [ae98c720] Jieko v0.2.1 [98e50ef6] JuliaFormatter v2.1.6 [70703baa] JuliaSyntax v0.4.10 [ccbc3e58] JumpProcesses v9.17.0 [ba0b0d4f] Krylov v0.10.1 [b964fa9f] LaTeXStrings v1.4.0 [23fbe1c1] Latexify v0.16.9 [10f19ff3] LayoutPointers v0.1.17 [0e77f7df] LazilyInitializedFields v1.3.0 [5078a376] LazyArrays v2.6.2 [87fe0de2] LineSearch v0.1.4 [d3d80556] LineSearches v7.4.0 [7ed4a6bd] LinearSolve v3.28.0 [2ab3a3ac] LogExpFunctions v0.3.29 [e6f89c97] LoggingExtras v1.1.0 [d8e11817] MLStyle v0.4.17 [1914dd2f] MacroTools v0.5.16 [d125e4d3] ManualMemory v0.1.8 [d0879d2d] MarkdownAST v0.1.2 [bb5d69b7] MaybeInplace v0.1.4 [739be429] MbedTLS v1.1.9 [442fdcdd] Measures v0.3.2 [e1d29d7a] Missings v1.2.0 [961ee093] ModelingToolkit v10.18.0 [2e0e35c7] Moshi v0.3.7 ``` -------------------------------- ### ExampleIntegrator Interface Fallbacks Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii This code defines fallback implementations for several SymbolicIndexingInterface methods for the `ExampleIntegrator` struct. It sets `symbolic_container`, `state_values`, `parameter_values`, and `current_time` to enable symbolic access and manipulation of the integrator's state and parameters. ```Julia mutable struct ExampleIntegrator u::Vector{Float64} p::Vector{Float64} t::Float64 sys::ExampleSystem end # define a fallback for the interface methods SymbolicIndexingInterface.symbolic_container(integ::ExampleIntegrator) = integ.sys SymbolicIndexingInterface.state_values(sys::ExampleIntegrator) = sys.u SymbolicIndexingInterface.parameter_values(sys::ExampleIntegrator) = sys.p SymbolicIndexingInterface.current_time(sys::ExampleIntegrator) = sys.t ``` -------------------------------- ### Re-creating a Buffer Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Explains the process of recreating a buffer using the symbolic indexing interface. This is often necessary when modifying parameters or states and needing to update the underlying data structure efficiently. ```Julia using SciMLBase # Assume 'sol' is a solution object and 't' is a time point # Example: Recreating a solution buffer at a specific time # new_sol_buffer = similar(sol, t) # This operation might involve re-indexing or re-evaluating based on the interface ``` -------------------------------- ### Define and Build ODESystem in Julia Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage This snippet defines a system of ordinary differential equations (ODEs) using ModelingToolkit in Julia. It sets up parameters, variables, and equations, then builds the ODESystem. ```Julia using ModelingToolkit, OrdinaryDiffEq, SymbolicIndexingInterface, Plots using ModelingToolkit: t_nounits as t, D_nounits as D @parameters σ ρ β @variables x(t) y(t) z(t) w(t) eqs = [D(D(x)) ~ σ * (y - x), D(y) ~ x * (ρ - z) - y, D(z) ~ x * y - β * z, w ~ x + y + z] @mtkbuild sys = ODESystem(eqs, t) ``` -------------------------------- ### SymbolicIndexingInterface: Get the index of a variable Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `variable_index` function returns the numerical index corresponding to a given symbolic variable `sym` within the index provider `indp`. If the structure is not constant, an optional time index `i` can be provided. ```Julia variable_index(indp, sym, [i]) ``` -------------------------------- ### Julia Dependencies for SymbolicIndexingInterface.jl Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/index Lists the direct dependencies used to build the documentation for the SymbolicIndexingInterface.jl package. This includes Documenter, ModelingToolkit, OrdinaryDiffEq, Plots, RuntimeGeneratedFunctions, and SymbolicIndexingInterface itself. ```Julia Status `~/work/SymbolicIndexingInterface.jl/SymbolicIndexingInterface.jl/docs/Project.toml` [e30172f5] Documenter v1.14.1 [961ee093] ModelingToolkit v10.18.0 [1dea7af3] OrdinaryDiffEq v6.101.0 [91a5bcdd] Plots v1.40.18 [7e49a35a] RuntimeGeneratedFunctions v0.5.15 [2efcf032] SymbolicIndexingInterface v0.3.43 `~/work/SymbolicIndexingInterface.jl/SymbolicIndexingInterface.jl` ``` -------------------------------- ### Symbolic Indexing Interface Terminology Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/terminology Explains the core terminology used in SymbolicIndexingInterface.jl, including Indexes, Symbolic variables, Index providers, and Value providers. These concepts are crucial for understanding how to access and manipulate data within symbolic systems. ```Julia # In code samples, an index is typically denoted with the name `idx` or `i`. # In code samples, a symbolic variable is typically denoted with the name `sym`. # In code samples, an index provider is typically denoted with the name `indp`. ``` -------------------------------- ### Symbolic Indexing Interface Functions Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api This section details the core functions for the Symbolic Indexing Interface, covering index provider, value provider, container objects, and symbolic traits. It outlines how to interact with symbolic systems. ```Julia # Interface Functions ## Index provider interface ``` -------------------------------- ### Get Timeseries Parameter Index Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Retrieves the index for a timeseries parameter `sym` within the index provider `indp`. It must return a `ParameterTimeseriesIndex` object, or `nothing` if `sym` is not a timeseries parameter. This function respects fallback mechanisms for `symbolic_container`. ```Julia timeseries_parameter_index(indp, sym) ``` -------------------------------- ### Define Solution Wrapper Fallbacks with SymbolicIndexingInterface Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/solution_wrappers Demonstrates how to create a custom solution wrapper that utilizes the SymbolicIndexingInterface.jl. It shows how to use `symbolic_container` to delegate interface calls to an embedded solution and how to override specific methods like `is_observed` for custom behavior. ```Julia struct MySolutionWrapper{T<:SciMLBase.AbstractTimeseriesSolution} sol::T # other properties... end symbolic_container(sys::MySolutionWrapper) = sys.sol ``` ```Julia is_observed(sys::MySolutionWrapper, sym) = false ``` -------------------------------- ### Get Symbol Values from Batched Interface Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Returns a function to retrieve values of symbols from a BatchedInterface. The function takes value providers and returns symbol values, with an option for in-place array population. Requires value providers to not be time series. ```Julia getsym(bi::BatchedInterface) ``` -------------------------------- ### Defining Solution Wrapper Fallbacks Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Covers the creation of fallback mechanisms for solution wrappers when using the symbolic indexing interface. This ensures that even if a direct symbolic mapping isn't available, the interface can still provide a functional way to access data. ```Julia using SciMLBase # Example of a fallback for accessing parameters if not directly symbolic # function get_parameter(sol, param_name::Symbol) # if hasproperty(sol, :p) && param_name in fieldnames(typeof(sol.p)) # return getproperty(sol.p, param_name) # else # # Fallback logic: e.g., search by index or default value # error("Parameter ", param_name, " not found") # end # end ``` -------------------------------- ### Recreate Buffer with Parameter Updates Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Demonstrates how to use the `remake_buffer` function to recreate a system's parameter buffer. It shows updating specific parameters (σ, ρ, β) with new Float32 values. ```Julia remake_buffer(sys, prob.p, Dict(σ => 1f0, ρ => 2f0, β => 3f0)) ``` -------------------------------- ### List of JLL Packages for sciml_ai_symbolicindexinginterface_stable Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/index This snippet lists the various JLL (Julia Language Support) packages that are dependencies for the sciml_ai_symbolicindexinginterface_stable project. JLL packages provide pre-compiled binaries for libraries, ensuring cross-platform compatibility. ```Julia using Pkg Pkg.add("HarfBuzz_jll") Pkg.add("IntelOpenMP_jll") Pkg.add("JpegTurbo_jll") Pkg.add("LAME_jll") Pkg.add("LERC_jll") Pkg.add("LLVMOpenMP_jll") Pkg.add("LZO_jll") Pkg.add("Libffi_jll") Pkg.add("Libglvnd_jll") Pkg.add("Libiconv_jll") Pkg.add("Libmount_jll") Pkg.add("Libtiff_jll") Pkg.add("Libuuid_jll") Pkg.add("MKL_jll") Pkg.add("Ogg_jll") Pkg.add("OpenSSH_jll") Pkg.add("OpenSSL_jll") Pkg.add("OpenSpecFun_jll") Pkg.add("Opus_jll") Pkg.add("Pango_jll") Pkg.add("Pixman_jll") Pkg.add("Qt6Base_jll") Pkg.add("Qt6Declarative_jll") Pkg.add("Qt6ShaderTools_jll") Pkg.add("Qt6Wayland_jll") Pkg.add("Rmath_jll") Pkg.add("Vulkan_Loader_jll") Pkg.add("Wayland_jll") Pkg.add("XZ_jll") Pkg.add("Xorg_libICE_jll") Pkg.add("Xorg_libSM_jll") Pkg.add("Xorg_libX11_jll") Pkg.add("Xorg_libXau_jll") Pkg.add("Xorg_libXcursor_jll") Pkg.add("Xorg_libXdmcp_jll") Pkg.add("Xorg_libXext_jll") Pkg.add("Xorg_libXfixes_jll") Pkg.add("Xorg_libXi_jll") Pkg.add("Xorg_libXinerama_jll") Pkg.add("Xorg_libXrandr_jll") Pkg.add("Xorg_libXrender_jll") Pkg.add("Xorg_libxcb_jll") Pkg.add("Xorg_libxkbfile_jll") Pkg.add("Xorg_xcb_util_cursor_jll") Pkg.add("Xorg_xcb_util_image_jll") Pkg.add("Xorg_xcb_util_jll") Pkg.add("Xorg_xcb_util_keysyms_jll") Pkg.add("Xorg_xcb_util_renderutil_jll") Pkg.add("Xorg_xcb_util_wm_jll") Pkg.add("Xorg_xkbcomp_jll") Pkg.add("Xorg_xkeyboard_config_jll") Pkg.add("Xorg_xtrans_jll") Pkg.add("Zstd_jll") Pkg.add("eudev_jll") Pkg.add("fzf_jll") Pkg.add("libaom_jll") Pkg.add("libass_jll") Pkg.add("libdecor_jll") Pkg.add("libevdev_jll") Pkg.add("libfdk_aac_jll") Pkg.add("libinput_jll") Pkg.add("libpng_jll") Pkg.add("libvorbis_jll") Pkg.add("mtdev_jll") Pkg.add("oneTBB_jll") Pkg.add("x264_jll") Pkg.add("x265_jll") Pkg.add("xkbcommon_jll") Pkg.add("CompilerSupportLibraries_jll") Pkg.add("LibCURL_jll") Pkg.add("LibGit2_jll") Pkg.add("LibSSH2_jll") Pkg.add("MbedTLS_jll") Pkg.add("MozillaCACerts_jll") Pkg.add("OpenBLAS_jll") Pkg.add("OpenLibm_jll") Pkg.add("PCRE2_jll") Pkg.add("SuiteSparse_jll") Pkg.add("Zlib_jll") Pkg.add("libblastrampoline_jll") Pkg.add("nghttp2_jll") Pkg.add("p7zip_jll") ``` -------------------------------- ### Accessing Solution Data with Tuples Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Demonstrates how to access solution data using tuples as indices. The returned data is a Vector of Tuples, where each inner tuple contains Float64 values. ```Julia sol[(:x, :w)] ``` -------------------------------- ### Get All Timeseries Indexes for Symbol Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api Returns a set of all unique timeseries indexes associated with a given symbolic variable `sym`. This function handles various input types for `sym` and defaults to returning `Set([ContinuousTimeseries()])` for non-timeseries parameters or continuous variables. ```Julia get_all_timeseries_indexes(indp, sym) ``` -------------------------------- ### SymbolicIndexingInterface: AllVariables singleton Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/api The `allvariables` constant is a singleton that serves as a shortcut for indexing all solution variables, including observed quantities. It provides a convenient way to access every variable in the system. ```Julia const allvariables = AllVariables() ``` -------------------------------- ### Manual DiffEqArray Implementation Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/complete_sii Illustrates a manual implementation of a `DiffEqArray` structure, named `MyDiffEqArray`, which is used to store timeseries data, including time points and corresponding state values. ```Julia struct MyDiffEqArray t::Vector{Float64} u::Vector{Vector{Float64}} end ``` -------------------------------- ### Create and Solve ODEProblem with Symbolic States in Julia Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/simple_sii_sys Constructs an `ODEProblem` with the symbolically defined `odefun` and initial conditions, time span, and parameters. It then solves the problem using the `Rosenbrock23` solver. ```Julia prob = ODEProblem(odefun, [1.0, 0.0, 0.0], (0.0, 1e5), [0.04, 3e7, 1e4]) sol = solve(prob, Rosenbrock23()) ``` -------------------------------- ### Accessing All Variables in Solution Source: https://docs.sciml.ai/SymbolicIndexingInterface/stable/usage Demonstrates accessing all state variables in a solution using the `solvedvariables` shorthand. This returns a Vector of Vectors, where each inner vector contains the values of all state variables. ```Julia sol[solvedvariables] ```