Re: Eliminating Annoying Minus Signs

• To: mathgroup at smc.vnet.net
• Subject: [mg58790] Re: Eliminating Annoying Minus Signs
• From: Andrzej Kozlowski <akozlowski at gmail.com>
• Date: Tue, 19 Jul 2005 04:10:01 -0400 (EDT)
• References: <200507170704.DAA02676@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On 17 Jul 2005, at 08:04, David Park wrote:

> 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
>
>

One possible way that will work not only in this case but in other
cases when what seems to be the "simplest" expression is not chosen
by Mathematica is to use

VisibleSimplify[expr_, opts___] := Simplify[
expr, opts, ComplexityFunction ->

or

VisibleFullSimplify[expr_, opts___] := FullSimplify[
expr, opts, ComplexityFunction ->

In this case:

VisibleSimplify[test]

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

VisibleSimplify should return the form of an expression that seems
"simplest" to "the human eye" among all those found by applying the
default (or user defined) transformation functions.

Andrzej Kozlowski

Wolfson College,
Univ. of Oxford,
UK.

```

• Prev by Date: Re: "2p" in BenchmarkReport[] ?
• Next by Date: What we get from (0.0*x), (0.0^x) and similar stuff
• Previous by thread: Re: Eliminating Annoying Minus Signs
• Next by thread: Re: Eliminating Annoying Minus Signs