JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
536 stars 107 forks source link

Simplifying Logarithms #400

Open cfarm6 opened 2 years ago

cfarm6 commented 2 years ago

There are currently no rules for simplifying additions and subtraction of logarithms. For example simplify(log(x)+log(2x)) yields log(x)+log(2x), not log(3x). Also, simplify(exp(log(x))) yields exp(log(x)) rather than x assuming x>=0.

Is there any reason not to add rules for logarithm addition, subtraction, multiplication, and simplification to the package? Or would there need to be some addition for the assumption that the argument of log is greater than 0?

The added rules would be @acrule log(~x) + log(~y) => log((~x)*(~y)) @rule log(~x) - log(~y) => log((~x)/(~y)) @rule (~x)*log(~y) => log((~y)^(~x)) @rule exp(log(~x)) => ~x