Given an Equation
generated by ModelingToolkit.jl, I want to check, programmatically, whether some variable exists in the equation. MWE:
using ModelingToolkit
@variables t # independent variable (time)
dDt = Differential(t) # define an operator for the differentiation w.r.t. time
@variables T(t) = 300.0 # temperature, in Kelvin
eq = (dDt(T) ~ T^4)
hasvariable(eq, T) # true, but how to code this function?
# I am also happy with having
hasvariable(eq.rhs, T)
context: i am developing some code that should in principle allow me to swap dynamical processes while generating a model, and if some variables exist or not, these processes need to be included or not.