You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symbolic variables can be created using the `@vars` macro:
9
+
Symbols can be created using the `@syms` macro:
10
10
11
11
```julia
12
12
julia>using SymbolicUtils
13
13
14
-
julia>@vars a::Integer b c d x::Real y::Number
14
+
julia>@syms a::Integer b c d x::Real y::Number
15
15
(a, b, c, d, x, y)
16
16
```
17
17
18
-
This macro also defines the Julia variables of the same name and each is set to the its respective symbolic variable object.
18
+
This macro also defines the Julia variables of the same name and each is set to the its respective symbolic object.
19
19
20
-
The associated type `T` in the `@vars a::T` syntax, called `symtype` of the variable, is the type the value of the variable is supposed to be of. These types may determine the rules of symbolic simplification.
20
+
The associated type `T` in the `@syms a::T` syntax, called `symtype` of the symbol, is the type the value of the symbol is supposed to be of. These types may determine the rules of symbolic simplification.
21
21
22
-
Arithmetic and math functions are defined on variables and return `Term` objects which represent function call expressions.
22
+
Arithmetic and math functions are defined on symbols and return `Term` objects which represent function call expressions.
23
23
24
-
Variables can be defined to behave like functions. Both the input and output types for the function can be specified. Any application to that function will only admit either values of those types or symbolic variables of the same `symtype`.
24
+
Symbols can be defined to behave like functions. Both the input and output types for the function can be specified. Any application to that function will only admit either values of those types or symbols of the same `symtype`.
25
25
26
26
```julia
27
-
julia>@varsf(x) g(x::Real, y::Real)::Real
27
+
julia>@symsf(x) g(x::Real, y::Real)::Real
28
28
(f(::Number)::Number, g(::Real, ::Real)::Real)
29
29
30
30
julia>f(c)
@@ -67,7 +67,7 @@ _Example:_
67
67
Simple rule to turn any `sin` into `cos`:
68
68
69
69
```julia
70
-
julia>@vars a b c
70
+
julia>@syms a b c
71
71
(a, b, c)
72
72
73
73
julia> r =@rulesin(~x) =>cos(~x)
@@ -153,7 +153,7 @@ is equivalent to `f(x, y, z, u, v, w)` and commutative if the order of arguments
153
153
SymbolicUtils has a special `@acrule` macro meant for rules on functions which are associate
154
154
and commutative such as addition and multiplication of real and complex numbers.
155
155
```julia
156
-
julia>@vars x y
156
+
julia>@syms x y
157
157
(x, y)
158
158
159
159
julia> acr =@acrule((~y)^(~n) *~y => (~y)^(~n+1))
@@ -169,7 +169,7 @@ Rules are applied to an entire term, they do not see sub-terms
169
169
```julia
170
170
julia>using SymbolicUtils
171
171
172
-
julia>@vars x y
172
+
julia>@syms x y
173
173
(x, y)
174
174
175
175
julia> r =@rulesin(~x) =>cos(~x)
@@ -233,15 +233,15 @@ Called only if `istree(x)` is `true`. Part of the API required
233
233
for `simplify` to work. Other required methods are `operation` and `istree`
234
234
235
235
#### `to_symbolic(x::S)`
236
-
Convert your variable type to a `SymbolicUtils.Variable`. Suppose you have
236
+
Convert your variable type to a `SymbolicUtils.Sym`. Suppose you have
237
237
```julia
238
238
struct MySymbol
239
239
s::Symbol
240
240
end
241
241
```
242
242
which could represent any type symbolically, then you would define
0 commit comments