@@ -26,7 +26,7 @@ sol = solve(prob, Tsit5())
26
26
@variables z (t)
27
27
forward_subs = [log (x) => z]
28
28
backward_subs = [x => exp (z)]
29
- new_sys = changeofvariables (sys, t, forward_subs, backward_subs)
29
+ new_sys = change_of_variables (sys, t, forward_subs, backward_subs)
30
30
@test equations (new_sys)[1 ] == (D (z) ~ α)
31
31
32
32
new_prob = ODEProblem (new_sys, [], tspan)
@@ -48,7 +48,7 @@ def = [x=>1., α => 1.]
48
48
forward_subs = [t + α/ (x+ t) => z ]
49
49
backward_subs = [ x => α/ (z- t) - t]
50
50
51
- new_sys = changeofvariables (sys, t, forward_subs, backward_subs; simplify= true , t0= 0. )
51
+ new_sys = change_of_variables (sys, t, forward_subs, backward_subs; simplify= true , t0= 0. )
52
52
# output should be equivalent to
53
53
# t^2 + α - z^2 + 2 (but this simplification is not found automatically)
54
54
@@ -86,7 +86,7 @@ z = reshape(z, 3, 1)
86
86
forward_subs = vec (T_inv* x .=> z)
87
87
backward_subs = vec (x .=> T* z)
88
88
89
- new_sys = changeofvariables (sys, t, forward_subs, backward_subs; simplify= true )
89
+ new_sys = change_of_variables (sys, t, forward_subs, backward_subs; simplify= true )
90
90
91
91
new_prob = ODEProblem (new_sys, [], tspan)
92
92
new_sol = solve (new_prob, Tsit5 ())
@@ -115,7 +115,7 @@ def = [x=>0., μ => 2., σ=>1.]
115
115
@mtkcompile sys = System (eqs, t; defaults= def)
116
116
forward_subs = [log (x) => y]
117
117
backward_subs = [x => exp (y)]
118
- new_sys = changeofvariables (sys, t, forward_subs, backward_subs)
118
+ new_sys = change_of_variables (sys, t, forward_subs, backward_subs)
119
119
@test equations (new_sys)[1 ] == (D (y) ~ μ - 1 / 2 * σ^ 2 )
120
120
@test noise_eqs (new_sys)[1 ] === value (σ)
121
121
@@ -131,7 +131,7 @@ forward_subs = [log(x) => z, y^2 => w, log(u) => v]
131
131
backward_subs = [x => exp (z), y => w^ .5 , u => exp (v)]
132
132
133
133
@mtkcompile sys = System (eqs, t; defaults= def)
134
- new_sys = changeofvariables (sys, t, forward_subs, backward_subs)
134
+ new_sys = change_of_variables (sys, t, forward_subs, backward_subs)
135
135
@test equations (new_sys)[1 ] == (D (z) ~ μ - 1 / 2 * σ^ 2 )
136
136
@test equations (new_sys)[2 ] == (D (w) ~ α^ 2 )
137
137
@test equations (new_sys)[3 ] == (D (v) ~ μ - 1 / 2 * (α^ 2 + σ^ 2 ))
@@ -144,7 +144,7 @@ new_sys = changeofvariables(sys, t, forward_subs, backward_subs)
144
144
145
145
# Test for Brownian instead of noise
146
146
@named sys = System (eqs, t; defaults= def)
147
- new_sys = changeofvariables (sys, t, forward_subs, backward_subs; simplify= false )
147
+ new_sys = change_of_variables (sys, t, forward_subs, backward_subs; simplify= false )
148
148
@test simplify (equations (new_sys)[1 ]) == simplify ((D (z) ~ μ - 1 / 2 * σ^ 2 + σ* Bx))
149
149
@test simplify (equations (new_sys)[2 ]) == simplify ((D (w) ~ α^ 2 + 2 * α* w^ .5 * By))
150
150
@test simplify (equations (new_sys)[3 ]) == simplify ((D (v) ~ μ - 1 / 2 * (α^ 2 + σ^ 2 ) + σ* Bx + α* By))
0 commit comments