simplify method
Possible simplifications:
- e^0 = 1
- e^1 = e
- e^(x*ln(y)) = y^x (usually easier to read for humans)
Implementation
@override
Expression simplify() {
final Expression expSimpl = exp.simplify();
if (_isNumber(expSimpl, 0)) {
return Number(1); // e^0 = 1
}
if (_isNumber(expSimpl, 1)) {
return Number(math.e); // e^1 = e
}
if (expSimpl is Times && expSimpl.second is Ln) {
final ln = expSimpl.second as Ln;
return Power(ln.arg, expSimpl.first); // e^(x*ln(y)) = y^x
}
return Exponential(expSimpl);
}