I'm trying to write a rule that acts on any number, lists, expression and so on to turn any negative numbers positive.
r = n_ -> Abs[n] works perfectly well for numbers, lists and nested lists, but does not work expressions, such as
Exp[-5], which is unaffected by my rule. I can't use the replace function, because I also require my rule to work for other Mathematica inputs, like numbers, lists and nested lists.
Can someone suggest why this does not work? Is it due to the rule not penetrating the expression? An edit to my rule would also be much appreciated.