@@ -21,16 +21,16 @@ to manipulate.
2121### Example: ODE
2222
2323Let's build an ODE. First we define some variables. In a differential equation
24- system, we need to differentiate between our unknown (dependent) variables
24+ system, we need to differentiate between our (dependent) variables
2525and parameters. Therefore we label them as follows:
2626
2727``` julia
2828using ModelingToolkit
2929
3030# Define some variables
31- @Param t σ ρ β
32- @Unknown x (t) y (t) z (t)
33- @Deriv D' ~ t
31+ @parameters t σ ρ β
32+ @variables x (t) y (t) z (t)
33+ @derivatives D' ~ t
3434```
3535
3636Then we build the system:
@@ -78,11 +78,11 @@ f = ODEFunction(de)
7878
7979We can also build nonlinear systems. Let's say we wanted to solve for the steady
8080state of the previous ODE. This is the nonlinear system defined by where the
81- derivatives are zero. We use unknown variables for our nonlinear system.
81+ derivatives are zero. We use ( unknown) variables for our nonlinear system.
8282
8383``` julia
84- @Unknown x y z
85- @Param σ ρ β
84+ @variables x y z
85+ @parameters σ ρ β
8686
8787# Define a nonlinear system
8888eqs = [0 ~ σ* (y- x),
@@ -173,7 +173,7 @@ structure is as follows:
173173 the system of equations.
174174- Name to subtype mappings: these describe how variable `subtype`s are mapped
175175 to the contexts of the system. For example, for a differential equation,
176- the unknown variable corresponds to given subtypes and then the `eqs` can
176+ the variable corresponds to given subtypes and then the `eqs` can
177177 be analyzed knowing what the state variables are.
178178- Variable names which do not fall into one of the system's core subtypes are
179179 treated as intermediates which can be used for holding subcalculations and
@@ -223,7 +223,7 @@ function via the dispatch:
223223
224224``` julia
225225# `N` arguments are accepted by the relevant method of `my_function`
226- ModelingToolkit. Derivative (:: typeof (my_function), args:: NTuple{N,Any} , :: Val{i} )
226+ ModelingToolkit. derivative (:: typeof (my_function), args:: NTuple{N,Any} , :: Val{i} )
227227```
228228
229229where `i` means that it's the derivative of the `i`th argument. `args` is the
@@ -233,7 +233,7 @@ You should return an `Operation` for the derivative of your function.
233233For example, `sin(t)`'s derivative (by `t`) is given by the following:
234234
235235``` julia
236- ModelingToolkit. Derivative (:: typeof (sin), args:: NTuple{1,Any} , :: Val{1} ) = cos (args[1 ])
236+ ModelingToolkit. derivative (:: typeof (sin), args:: NTuple{1,Any} , :: Val{1} ) = cos (args[1 ])
237237```
238238
239239### Macro-free Usage
@@ -243,31 +243,31 @@ is accessible via a function-based interface. This means that all macros are
243243syntactic sugar in some form. For example, the variable construction:
244244
245245``` julia
246- @Param t σ ρ β
247- @Unknown x (t) y (t) z (t)
248- @Deriv D' ~ t
246+ @parameters t σ ρ β
247+ @variables x (t) y (t) z (t)
248+ @derivatives D' ~ t
249249```
250250
251251is syntactic sugar for:
252252
253253``` julia
254- t = Parameter (:t )
255- x = Unknown (:x , [t])
256- y = Unknown (:y , [t])
257- z = Unknown (:z , [t])
254+ t = Variable (:t ; known = true )
255+ x = Variable (:x , [t])
256+ y = Variable (:y , [t])
257+ z = Variable (:z , [t])
258258D = Differential (t)
259- σ = Parameter (:σ )
260- ρ = Parameter (:ρ )
261- β = Parameter (:β )
259+ σ = Variable (:σ ; known = true )
260+ ρ = Variable (:ρ ; known = true )
261+ β = Variable (:β ; known = true )
262262```
263263
264264### Intermediate Calculations
265265
266266The system building functions can handle intermediate calculations. For example,
267267
268268``` julia
269- @Unknown x y z
270- @Param σ ρ β
269+ @variables x y z
270+ @parameters σ ρ β
271271a = y - x
272272eqs = [0 ~ σ* a,
273273 0 ~ x* (ρ- z)- y,
0 commit comments