How to equivalently convert $e iπ $ in the expression to −1 ?

1/9 (7 - 2^m E^(I m [Pi]) (7 + 3 m))

2026-04-06_170324.png

1/9 (7 - (-2)^m (7 + 3 m))

I tried using the following method myself:

expr = 1/9 (7 - 2^m E^(I m \[Pi]) (7 + 3 m));
expr /. E^(I m \[Pi]) -> (-1)^m // Simplify

My current requirement is: without using manual identification and substitution methods, what other methods can automatically replace the Euler’s formula part in it with -1?

Try:

FullSimplify[1/9 (7 - 2^m E^(I m \[Pi]) (7 + 3 m)),  Assumptions -> m \[Element] Integers]

Here is one alternative:

expr = 1/9 (7 - 2^m E^(I m \[Pi]) (7 + 3 m))
rule = n_^x_*E^(I*\[Pi]*x_) :> (-n)^x;
expr /. rule