Symbolics.jl
Symbolics.jl copied to clipboard
substitutions for powers and fractions
Hi, Certain substitutions do not work the way I would expect. For example:
@variables x y
eq1 = (1/x)^2
substitute(eq1, Dict([1/x => y]))
julia> y^2
eq2 = 1/x^2
substitute(eq2, Dict([1/x => y]))
julia> 1 / (x^2)
I expected the answers to be equivalent.
Fractions aren't handled the way I would expect either:
@variables x y z
eq3 = x/y
substitute(eq3, Dict([1/y => z]))
julia> x/y
Finally, substitution doesn't work the way you would expect with mononmials,
eq4 = (x^2)^2
substitute(eq4, Dict([x^2 => y]))
julia> x^4
I expected it to return y^2
.
I use Julia version 1.7.1 with Symbolics v4.4.3.