Re: Eliminating Annoying Minus Signs

• To: mathgroup at smc.vnet.net
• Subject: [mg58768] Re: [mg58756] Eliminating Annoying Minus Signs
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sun, 17 Jul 2005 13:03:13 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```test={-((2*x)/(-1+z)),-((2*y)/(-1+z)),-1};

FullSimplify[test,ComplexityFunction:>(Count[{#},_Times[_Negative,__],?]&)]

{(2*x)/(1 - z), (2*y)/(1 - z), -1}

However, this will likely be undone by any subsequent use of simplification
with the default ComplexityFunction

%//Simplify

{-((2*x)/(z - 1)), -((2*y)/(z - 1)), -1}

Bob Hanlon

>
> From: "David Park" <djmp at earthlink.net>
To: mathgroup at smc.vnet.net
> Date: 2005/07/17 Sun AM 03:04:06 EDT
> Subject: [mg58768] [mg58756] Eliminating Annoying Minus Signs
>
> Here is an expression that has annoying minus signs in it.
>
> test = {-((2*x)/(-1 + z)), -((2*y)/(-1 + z)), -1};
>
> We can get rid of them with the following operation.
>
> MapAt[Minus, test, {{1, 1}, {1, 3, 1}, {2, 1}, {2, 3, 1}}]
> {(2*x)/(1 - z), (2*y)/(1 - z), -1}
>
> But it involves ferreting out the two positions at which we want to change
signs and so is a little tedious and error prone.
>
> Does someone have a simpler method for simplifying such expressions,
which occur quite often with Mathematica?
>
> David Park