Skip to content

Commit a88c715

Browse files
Clean up examples
1 parent 7ef34ba commit a88c715

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ and parameters. Therefore we label them as follows:
2828
using ModelingToolkit
2929

3030
# Define some variables
31-
@Param t
31+
@Param t σ ρ β
3232
@Unknown x(t) y(t) z(t)
3333
@Deriv D'~t
34-
@Param σ ρ β
3534
```
3635

3736
Then we build the system:
@@ -259,10 +258,9 @@ is accessible via a function-based interface. This means that all macros are
259258
syntactic sugar in some form. For example, the variable construction:
260259

261260
```julia
262-
@Param t
261+
@Param t σ ρ β
263262
@Unknown x(t) y(t) z(t)
264263
@Deriv D'~t
265-
@Param σ ρ β
266264
```
267265

268266
is syntactic sugar for:

src/variables.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ end
88
Variable(name; subtype::Symbol, dependents::Vector{Variable} = Variable[]) =
99
Variable(name, subtype, nothing, dependents)
1010

11-
Parameter(name,args...;kwargs...) = Variable(name,args...;subtype=:Parameter,kwargs...)
12-
Unknown(name,args...;kwargs...) = Variable(name,args...;subtype=:Unknown,kwargs...)
11+
Parameter(name; kwargs...) = Variable(name; subtype=:Parameter, kwargs...)
12+
Unknown(name, ;kwargs...) = Variable(name; subtype=:Unknown, kwargs...)
1313

14-
export Variable, Parameter, Constant, Unknown, @Param, @Const, @Unknown
14+
export Variable, Unknown, Parameter, Constant, @Unknown, @Param, @Const
1515

1616

1717
Base.copy(x::Variable) = Variable(x.name, x.subtype, x.diff, x.dependents)

test/basic_variables_and_operations.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using ModelingToolkit
22
using Test
33

4-
@Param t
4+
@Param t σ ρ β
55
@Unknown x(t) y(t) z(t)
6-
76
@Deriv D'~t # Default of first derivative, Derivative(t,1)
8-
@Param σ ρ β
97
@Const c=0
108

119
# Default values

test/derivatives.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ using ModelingToolkit
22
using Test
33

44
# Derivatives
5-
@Param t
5+
@Param t σ ρ β
66
@Unknown x(t) y(t) z(t)
7-
@Param σ ρ β
87
@Deriv D'~t
98
dsin = D(sin(t))
109
expand_derivatives(dsin)

test/system_construction.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ using ModelingToolkit
22
using Test
33

44
# Define some variables
5-
@Param t
5+
@Param t σ ρ β
66
@Unknown x(t) y(t) z(t)
77
@Deriv D'~t # Default of first derivative, Derivative(t,1)
8-
@Param σ ρ β
98
@Const c=0
109

1110
# Define a differential equation

0 commit comments

Comments
 (0)