Why is the following expression not getting simplified?
julia> using Symbolics
julia> @variables a, b
julia> expr=2.25e-7(2.701832006722774e6a - 1.0131921447234855e6(b + 7.999959398007795a))
julia> simplify(expr)
2.25e-7(2.701832006722774e6a - 1.0131921447234855e6(b + 7.999959398007795a))
Sevi
September 11, 2023, 9:39am
2
I’m not sure if “simplify” is always well-defined, but I just assume that you want the parentheses expanded and the factors of a
and b
grouped together?
simplify
has a keyword expand
for that:
julia> using Symbolics
julia> @variables a, b;
julia> expr = 2(3a - 4(b + 5a))
2(3a - 4(b + 5a))
julia> simplify(expr)
2(3a - 4(b + 5a))
julia> simplify(expr; expand=true)
-8b - 34a
1 Like
Indeed, that works:
julia> simplify(expr; expand=true)
-0.22796823256278423b - 1.215824403025248a
Thank you!
1 Like