Skip to content

Commit a965fa2

Browse files
Merge pull request #1491 from ValentinKaisermayer/patch-@register
fixes deprecation from Symbolics
2 parents 3652b68 + 8e99d31 commit a965fa2

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

docs/src/basics/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ ERROR: TypeError: non-boolean (Num) used in boolean context
4141

4242
then it's likely you are trying to trace through a function which cannot be
4343
directly represented in Julia symbols. The techniques to handle this problem,
44-
such as `@register`, are described in detail
44+
such as `@register_symbolic`, are described in detail
4545
[in the Symbolics.jl documentation](https://symbolics.juliasymbolics.org/dev/manual/faq/#Transforming-my-function-to-a-symbolic-equation-has-failed.-What-do-I-do?-1).

docs/src/basics/Validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ D = Differential(t)
8282
struct NewType
8383
f
8484
end
85-
@register dummycomplex(complex::Num, scalar)
85+
@register_symbolic dummycomplex(complex::Num, scalar)
8686
dummycomplex(complex, scalar) = complex.f - scalar
8787

8888
c = NewType(1)

docs/src/tutorials/ode_modeling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ of random values:
165165
```julia
166166
value_vector = randn(10)
167167
f_fun(t) = t >= 10 ? value_vector[end] : value_vector[Int(floor(t))+1]
168-
@register f_fun(t)
168+
@register_symbolic f_fun(t)
169169

170170
@named fol_external_f = ODESystem([f ~ f_fun(t), D(x) ~ (f - x)/τ])
171171
prob = ODEProblem(structural_simplify(fol_external_f), [x => 0.0], (0.0,10.0), [τ => 0.75])

test/direct.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ canonequal(a, b) = isequal(simplify(a), simplify(b))
1717
-sin(x) * cos(cos(x))
1818
)
1919

20-
@register no_der(x)
20+
@register_symbolic no_der(x)
2121
@test canonequal(
2222
ModelingToolkit.derivative([sin(cos(x)), hypot(x, no_der(x))], x),
2323
[
@@ -26,7 +26,7 @@ canonequal(a, b) = isequal(simplify(a), simplify(b))
2626
]
2727
)
2828

29-
@register intfun(x)::Int
29+
@register_symbolic intfun(x)::Int
3030
@test ModelingToolkit.symtype(intfun(x)) === Int
3131

3232
eqs =*(y-x),
@@ -196,7 +196,7 @@ test_worldage()
196196
@test_nowarn [x, y, z]'
197197

198198
let
199-
@register foo(x)
199+
@register_symbolic foo(x)
200200
@variables t
201201
D = Differential(t)
202202

test/discretesystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ RHS2 = RHS
141141
end
142142

143143
dummy_identity(x, _) = x
144-
@register dummy_identity(x, y)
144+
@register_symbolic dummy_identity(x, y)
145145

146146
u0 = ones(5)
147147
p0 = Float64[]

test/function_registration.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module MyModule
1515
function do_something(a)
1616
a + 10
1717
end
18-
@register do_something(a)
18+
@register_symbolic do_something(a)
1919

2020
eq = Dt(u) ~ do_something(x) + MyModule.do_something(x)
2121
@named sys = ODESystem([eq], t, [u], [x])
@@ -38,7 +38,7 @@ module MyModule2
3838
function do_something_2(a)
3939
a + 20
4040
end
41-
@register do_something_2(a)
41+
@register_symbolic do_something_2(a)
4242

4343
eq = Dt(u) ~ do_something_2(x) + MyNestedModule.do_something_2(x)
4444
@named sys = ODESystem([eq], t, [u], [x])
@@ -60,7 +60,7 @@ Dt = Differential(t)
6060
function do_something_3(a)
6161
a + 30
6262
end
63-
@register do_something_3(a)
63+
@register_symbolic do_something_3(a)
6464

6565
eq = Dt(u) ~ do_something_3(x) + (@__MODULE__).do_something_3(x)
6666
@named sys = ODESystem([eq], t, [u], [x])
@@ -74,7 +74,7 @@ u0 = 7.0
7474
# ---------------------------------------------------
7575
foo(x, y) = sin(x) * cos(y)
7676
@parameters t; @variables x(t) y(t) z(t); D = Differential(t)
77-
@register foo(x, y)
77+
@register_symbolic foo(x, y)
7878

7979
using ModelingToolkit: value, arguments, operation
8080
expr = value(foo(x, y))
@@ -95,7 +95,7 @@ ModelingToolkit.derivative(::typeof(foo), (x, y), ::Val{2}) = -sin(x) * sin(y) #
9595
function do_something_4(a)
9696
a + 30
9797
end
98-
@register do_something_4(a)
98+
@register_symbolic do_something_4(a)
9999
function build_ode()
100100
@parameters t x
101101
@variables u(t)
@@ -113,6 +113,6 @@ run_test()
113113

114114
using ModelingToolkit: arguments
115115
@variables a
116-
@register foo(x,y,z)
116+
@register_symbolic foo(x,y,z)
117117
@test 1 * foo(a,a,a) * Num(1) isa Num
118118
@test !any(x->x isa Num, arguments(value(1 * foo(a,a,a) * Num(1))))

test/odesystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ eqs[end] = D(D(z)) ~ α*x - β*y
552552
end
553553

554554
dummy_identity(x, _) = x
555-
@register dummy_identity(x, y)
555+
@register_symbolic dummy_identity(x, y)
556556

557557
u0 = ones(5)
558558
p0 = Float64[]

0 commit comments

Comments
 (0)