Thanks for your contributions! I think it was a good choice to strip out Symbolics
as a separate package. I can’t wait to start playing with it.
There are a few things that is not clear for me in the documentation; perhaps I am looking in the wrong place? The concept of variables
is straightforward, but the concept of parameters
is not really described?? The concept parameter is used differently in different fields, e.g., in Modelica it means a constant. I seem to recall to have seen a suggestion that for ModelingToolkit
(and probably Symbolics
), “parameter” includes constants, independent variables, and known functions of independent variables (??).
Let me highlight the problem by including some code from the Symbolics
documentation – there is some code that is presented both via macros and via a non-macro description… First the macro description:
@parameters t α σ(..) β[1:2]
@variables w(..) x(t) y z(t, α, x)
expr = β₁* x + y^α + σ(3) * (z - t) - β₂ * w(t - 1)
[It is not clear to me what an uncalled function implies. Here, I am guessing that α
and β
are constants, that t
is an independent variable (time), and that σ
is defined to be some function; it is not clear what the argument should be.
Furthermore, I am guessing that x(t)
and z(t,α,x)
are *dependent variables, it is not clear to me what type of variable y
is – an algebraic variable for which you do not take derivatives??, while w
again is some sort of uncalled variable – from expr
, we can clearly make w
a function of time.]
It is interesting to contrast this with the non-macro version…
σ = Num(Variable{Symbolics.FnType{Tuple{Any},Real}}(:σ)) # left uncalled, since it is used as a function
w = Num(Variable{Symbolics.FnType{Tuple{Any},Real}}(:w)) # unknown, left uncalled
x = Num(Variable{Symbolics.FnType{Tuple{Any},Real}}(:x))(t) # unknown, depends on `t`
y = Num(Variable(:y)) # unknown, no dependents
z = Num(Variable{Symbolics.FnType{NTuple{3,Any},Real}}(:z))(t, α, x) # unknown, multiple arguments
β₁ = Num(Variable(:β, 1)) # with index 1
β₂ = Num(Variable(:β, 2)) # with index 2
expr = β₁ * x + y^α + σ(3) * (z - t) - β₂ * w(t - 1)
Here, I observe the following:
-
t
andα
are used inexpr
, but have not been defined individually in the non-macro version. Perhaps not needed, as these are given as arguments in the definitions ofx
andz
?? - Quantities that are not constants or independent variables (
y
,β
) are defined simply using theNum(Variable(:y))
syntax, i.e., there is no mentioning ofSymbolics
andFnType
. - All functions/dependent variables are constructed with the inclusion of the
Symbolics.FnType
type. -
Uncalled functions (
σ
,w
) are given without the specification of an argument list, while dependent variables/“called” functions are given with a list of arguments.
By contrasting the macro version and the non-macro version, it seems like there is no real difference between parameters
and variables
: there is no obvious difference between σ
(“parameter”) and w
(variable) in the no-macro description.
Also, in some of the code for symbolically defining differential equations, t
seems sometimes to be given as a parameter, while other times it is given as a variable.
→ Anyway, some clarification of this would be helpful