-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Let's consider a system, sys, with
states = [X, Y, Z]
Here, I will keep my examples to variables, but the same functionality would be useful for parameters as well (and the corresponding parameter_index and parameter_symbols functions).
Request 1, expand variable_index to other cases
Currently, if sym is any of Y, :Y, 1, then variable_index(sys, sym) returns 2 (which is useful in e.g. the BifurcationKit extension, to find the index of e.g. a bifurcation parameter). Would it be possible to make it cover cases when you give arrays, maps, and dictionaries? E.g for
[X, Z] it is broadcasted over the array and you get [1, 3]. Similarly
[X => 1.5, Z => 0.0] becomes [1 => 1.5, 3 => 0.0]
and Dict([X => 1.5, Z => 0.0]) becomes Dict([1 => 1.5, 3 => 0.0]).
These cases are quite niche, but seems like a natural extension. E.g. conversions to maps would be useful in some cases where I interface Catalyst to JumpProcessess to creat spatial Jumps (which contain [1 => 1.5, 3 => 0.0] type structures).
Request 2, allow variable_symbols to be employed more generally
Say that we want to go the other way (from any of Y, :Y, 1 to Y). Here, we can use
variable_symbols(sys)[sym] to receive Y only of sym is 1. If we instead do
variable_symbols(sys)[variable_index(sys, sym)] it works generally.
Would it be possible to either generalise variable_symbols(sys) to a variable_symbols(sys, sym) function which is just variable_symbols(sys)[variable_index(sys, sym)]? Furthermore, would it be possible to apply this to the various forms:
[:X, :Z]
[:X => 1.5, :Z => 0.0]
Dict([:X => 1.5, :Z => 0.0])
A version of this we already got in Catalyst where XProblem input initial conditions and parameters can be on the two latter forms. Conversion to array could be useful in StructuralIdentifiabiltiy where arrays are used to e.g. signify which parameter values are already known.