Skip to content

Commit 2d5aa12

Browse files
committed
Use vars(ex; op = Nothing) instead of get_variables(ex)
1 parent 2afacb5 commit 2d5aa12

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/systems/diffeqs/basic_transformations.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ function change_independent_variable(sys::AbstractODESystem, iv, eqs = []; dummi
123123

124124
# 1) Utility that performs the chain rule on an expression, e.g. (d/dt)(f(t)) -> (d/dt)(f(u(t))) -> df(u(t))/du(t) * du(t)/dt
125125
function chain_rule(ex)
126-
vars = get_variables(ex)
127-
for var_of_iv1 in vars # loop through e.g. f(t)
126+
for var_of_iv1 in vars(ex; op = Nothing) # loop over all variables in expression, e.g. f(t) (op = Nothing so "D(f(t))" yields only "f(t)" and not "D(f(t))"; we want to replace *inside* derivative signs)
128127
if iscall(var_of_iv1) && isequal(only(arguments(var_of_iv1)), iv1) && !isequal(var_of_iv1, iv2_of_iv1) # handle e.g. f(t) -> f(u(t)), but not u(t) -> u(u(t))
129128
var_of_iv2 = substitute(var_of_iv1, iv1 => iv2_of_iv1) # e.g. f(t) -> f(u(t))
130129
ex = substitute(ex, var_of_iv1 => var_of_iv2)

0 commit comments

Comments
 (0)