Symbolics.jl simplify exp(0) to 1

It would be nice to have such simple rules available by default. You could define the rules yourself.

For example:

rules = RuleSet([
    @rule(exp(0) => 1),
    @rule(sin(-(~x)) => -(sin(~x))),
    @rule(cos(-(~x)) => cos(~x))
])

H2 = map(H) do h
    re = simplify(real(h), rewriter=rules)
    im_part = simplify(imag(h), rewriter=rules)
    re + im * im_part
end

Will yield

2×2 Matrix{Complex{Num}}:
 0  cos(-α)*sin(t*sin(-α))*exp(t*cos(-α)) - cos(α)*sin(t*sin(-α))*exp(t*cos(-α)) + (sin(-α) + sin(α))*cos(t*sin(-α))*exp(t*cos(-α)) + im*(-cos(-α)*cos(t*sin(-α))*exp(t*cos(-α)) + cos(α)*cos(t*sin(-α))*exp(t*cos(-α)) + (sin(-α) + sin(α))*sin(t*sin(-α))*exp(t*cos(-α)))
 0   cos(-α)*cos(t*sin(-α))*exp(t*cos(-α)) - cos(α)*cos(t*sin(-α))*exp(t*cos(-α)) - (sin(-α) + sin(α))*sin(t*sin(-α))*exp(t*cos(-α)) + im*(cos(-α)*sin(t*sin(-α))*exp(t*cos(-α)) - cos(α)*sin(t*sin(-α))*exp(t*cos(-α)) + (sin(-α) + sin(α))*cos(t*sin(-α))*exp(t*cos(-α)))

I’m not sure why the cos(-α) is not taking…

edit:

This works:

rules = RuleSet([
    @rule(exp(0) => 1),
    @rule(sin((-1) * (~x)) => -(sin(~x))),
    @rule(cos((-1) * (~x)) => cos(~x)),
])

that yields

2×2 Matrix{Complex{Num}}:
 0  0
 0  0