I'm trying to accomplish this replacement rule:
z^-n_ -> Cos[n]
but I can't get it to work.
However, it does work, if I remove the minus sign:
z^n_ -> Cos[n]
And it does work, if I set n to a specific value, such as 2:
z^-2 -> Cos
In other words, the replacement rule is not working when the sign is negative and n is non-specific.
I see the cause of the problem when I look at the FullForm of the replacement rule. I'm sure there must be a work-around. How do I get it to work?
Thanks for your help.
(My first post.)