Skip to content

Commit 4a37ed9

Browse files
committed
Add doctests
1 parent 30c80db commit 4a37ed9

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/Symbolics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ include("complex.jl")
6868
6969
Performs the substitution on `expr` according to rule(s) `s`.
7070
# Examples
71-
```julia
71+
```jldoctest
7272
julia> @variables t x y z(t)
7373
4-element Vector{Num}:
7474
t

src/linear_algebra.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Currently only works if all equations are linear. `check` if the expr is linear
8383
w.r.t `vars`.
8484
8585
# Examples
86-
```julia
86+
```jldoctest
8787
julia> @variables x y
8888
2-element Vector{Num}:
8989
x

src/taylor.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Return the power series in `x` around `x0` to the powers `ns` with coefficients
1010
Examples
1111
========
1212
13-
```julia
13+
```jldoctest
1414
julia> @variables x y[0:3] z
1515
3-element Vector{Any}:
1616
x
@@ -47,7 +47,7 @@ Calculate the `n`-th order coefficient(s) in the Taylor series of `f` around `x
4747
4848
Examples
4949
========
50-
```julia
50+
```jldoctest
5151
julia> @variables x y
5252
2-element Vector{Num}:
5353
x
@@ -101,7 +101,7 @@ If `rationalize`, float coefficients are approximated as rational numbers (this
101101
102102
Examples
103103
========
104-
```julia
104+
```jldoctest
105105
julia> @variables x
106106
1-element Vector{Num}:
107107
x

src/utils.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Return a vector of variables appearing in `e`, optionally restricting to variabl
2727
Note that the returned variables are not wrapped in the `Num` type.
2828
2929
# Examples
30-
```julia
30+
```jldoctest
3131
julia> @variables t x y z(t);
3232
3333
julia> Symbolics.get_variables(x + y + sin(z); sort = true)
@@ -97,7 +97,7 @@ Convert a differential variable to a `Term`. Note that it only takes a `Term`
9797
not a `Num`.
9898
Any upstream metadata can be passed via `x_metadata`
9999
100-
```julia
100+
```jldoctest
101101
julia> @variables x t u(x, t) z(t)[1:2]; Dt = Differential(t); Dx = Differential(x);
102102
103103
julia> Symbolics.diff2term(Symbolics.value(Dx(Dt(u))))
@@ -156,7 +156,7 @@ it will only output `y` instead of `y(t)`.
156156
157157
# Examples
158158
159-
```julia
159+
```jldoctest
160160
julia> @variables t z(t)
161161
2-element Vector{Num}:
162162
t
@@ -251,7 +251,7 @@ Extract the degree of `p` with respect to `sym`.
251251
252252
# Examples
253253
254-
```julia
254+
```jldoctest
255255
julia> @variables x;
256256
257257
julia> Symbolics.degree(x^0)
@@ -305,7 +305,7 @@ Note that `p` might need to be expanded and/or simplified with `expand` and/or `
305305
306306
# Examples
307307
308-
```julia
308+
```jldoctest
309309
julia> @variables a x y;
310310
311311
julia> Symbolics.coeff(2a, x)

src/variable.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ expr = β[1]* x + y^α + σ(3) * (z - t) - β[2] * w(t - 1)
418418
419419
Symbolics supports creating variables that denote an array of some size.
420420
421-
```julia
421+
```jldoctest
422422
julia> @variables x[1:3]
423423
1-element Vector{Symbolics.Arr{Num, 1}}:
424424
x[1:3]
@@ -436,7 +436,7 @@ julia> @variables t z(t)[1:3] # also works for dependent variables
436436
A symbol or expression that represents an array can be turned into an array of
437437
symbols or expressions using the `scalarize` function.
438438
439-
```julia
439+
```jldoctest
440440
julia> Symbolics.scalarize(z)
441441
3-element Vector{Num}:
442442
(z(t))[1]
@@ -451,7 +451,7 @@ operator, and in this case, `@variables` doesn't automatically assign the value,
451451
instead, it only returns a vector of symbolic variables. All the rest of the
452452
syntax also applies here.
453453
454-
```julia
454+
```jldoctest
455455
julia> a, b, c = :runtime_symbol_value, :value_b, :value_c
456456
(:runtime_symbol_value, :value_b, :value_c)
457457
@@ -676,7 +676,7 @@ notation. Use `@variables` instead to create symbolic array variables (as
676676
opposed to array of variables). See `variable` to create one variable with
677677
subscripts.
678678
679-
```julia-repl
679+
```jldoctest
680680
julia> Symbolics.variables(:x, 1:3, 3:6)
681681
3×4 Matrix{Num}:
682682
x₁ˏ₃ x₁ˏ₄ x₁ˏ₅ x₁ˏ₆
@@ -694,7 +694,7 @@ end
694694
Create a variable with the given name along with subscripted indices with the
695695
`symtype=T`. When `T=FnType`, it creates a symbolic function.
696696
697-
```julia-repl
697+
```jldoctest
698698
julia> Symbolics.variable(:x, 4, 2, 0)
699699
x₄ˏ₂ˏ₀
700700

0 commit comments

Comments
 (0)