       Re: Eliminating Annoying Minus Signs

• To: mathgroup at smc.vnet.net
• Subject: [mg58777] Re: Eliminating Annoying Minus Signs
• From: Peter Pein <petsie at dordos.net>
• Date: Mon, 18 Jul 2005 03:21:16 -0400 (EDT)
• References: <dbd12i\$2tc\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```David Park schrieb:
> 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
>
Hi David,

Try setting \$Post appropriate:

In:= \$Post = InputForm; (* just for copying to email *)

In:= test = {-((2*x)/(-1 + z)), -((2*y)/(-1 + z)), -1}
Out//InputForm= {(-2*x)/(-1 + z), (-2*y)/(-1 + z), -1}

In:= oldPost = If[ValueQ[\$Post], \$Post, Identity];
\$Post = Simplify[oldPost[#1],
ComplexityFunction -> (Count[#1, x_ /; x < 0, Infinity] & )] & ;

In:= test
Out//InputForm= {(2*x)/(1 - z), (2*y)/(1 - z), -1}

hope this helps a bit,
Peter

--
Peter Pein
Berlin
http://people.freenet.de/Peter_Berlin/

```

• Prev by Date: "2p" in BenchmarkReport[] ?
• Next by Date: Re: Re: Eliminating Annoying Minus Signs
• Previous by thread: Re: Eliminating Annoying Minus Signs
• Next by thread: Re: Re: Eliminating Annoying Minus Signs