From ae50f9d2dd4eb9e94f662ba8c4679c9f243a5836 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 27 Dec 2023 16:45:10 +0530 Subject: [PATCH] fixup! refactor: add new *_symbols methods, corresponding singletons, update tests --- docs/Project.toml | 1 + docs/src/usage.md | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 9722c57c..1e8f5271 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,6 +2,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5" [compat] diff --git a/docs/src/usage.md b/docs/src/usage.md index 2100b81e..d45d5048 100644 --- a/docs/src/usage.md +++ b/docs/src/usage.md @@ -4,7 +4,7 @@ This tutorial will cover ways to use the interface for types that implement it. Consider the following example: ```@example Usage -using ModelingToolkit, OrdinaryDiffEq, SymbolicIndexingInterface +using ModelingToolkit, OrdinaryDiffEq, SymbolicIndexingInterface, Plots @parameters σ ρ β @variables t x(t) y(t) z(t) w(t) @@ -46,7 +46,7 @@ sol[x] ``` This also works for arrays or tuples of variables, including observed quantities and -independent variables, and for interpolating solutions: +independent variables, for interpolating solutions, and plotting: ```@example Usage sol[[x, y]] ``` @@ -60,13 +60,17 @@ sol(1.3, idxs=x) ``` ```@example Usage -sol(1.3, idxs=[x, w]) # cannot use tuples of variables for interpolation +sol(1.3, idxs=[x, w]) ``` ```@example Usage sol(1.3, idxs=[:y, :z]) ``` +```@example Usage +plot(sol, idxs=x) +``` + If necessary, `Symbol`s can be used to refer to variables. This is only valid for symbolic variables for which [`hasname`](@ref) returns `true`. The `Symbol` used must match the one returned by [`getname`](@ref) for the variable.