Re: Re: Eliminating Annoying Minus Signs

*To*: mathgroup at smc.vnet.net*Subject*: [mg58781] Re: [mg58759] Re: Eliminating Annoying Minus Signs*From*: "David Park" <djmp at earthlink.net>*Date*: Mon, 18 Jul 2005 03:21:19 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Hi David, I remember looking at that package and thinking it was rather neat. I copied the idea of using color, in a different way, in the ExpressionManipulation package at my web site. But I think the approach is a bit involved for routine use. Yehuda suggested the good routine here. NDSignSwitch = -Numerator[#]/(-Denominator[#])& (The Function header prevents cancellation of the minus signs.) Then that could be mapped to the relevant terms that we wanted to simplify. I don't think we would have to do it in this case, but sometimes we want to apply a function to only a select set of terms in a sum or factors in a product. I discussed two routines, MapLevelParts and MapLevelPatterns in MathGroup recently that allow this. These two routines are in the Tensorial package. I think this is a useful but missing functionality in Mathematica. But there is still the problem of getting the positions of selected parts of an expression. The ExpressionManipulation package had a palette for doing that, but it is not 100 percent. One problem is that when an expression is copied in Mathematica, sometimes the underlying expression is changed. Even an Output expression - I think. The ExpressionManipulation package has an extendedPosition so that you could select a set of level subparts of an expression and still obtain a position. It also gave all the positions of the selection in the expression if it occured more than once. So then one had to pick out the one actually wanted, but there was provision for highlighting a selected position. But I really wasn't happy enough with it to push it. A really solid palette to give the positions of highlighted parts of an expression would be a great boon! David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: David Bailey [mailto:dave at Remove_Thisdbailey.co.uk] To: mathgroup at smc.vnet.net 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 > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > Some years ago I wrote a package that let you specify algebraic manipulations by selecting parts of an expression and colouring them using a palette button. The colouring was applied using a TagBox so that there was 'handle' that subsequent operations could relate to. Although it worked quite well, there was only limited interest in the idea, and the package would need a little maintenance now because it used Red, Green, Blue, etc. (Yes, I know such symbols are reserved for Wolfram). Using colour, you could specify quite elaborate things. For example, given a b c==d e f you could colour the f and ask for it to be moved to the opposite side of the equality (on the denominator of course). Contact me if you are interested, and I will try to resurrect it. David Bailey http://www.dbaileyconsultancy.co.uk

**Re: Re: Eliminating Annoying Minus Signs**

**Re: Validating functions input**

**Re: Re: Eliminating Annoying Minus Signs**

**Trace[ Through [ (Max - Min) [ {1, 2, 3, 4, 5} ] ] ]**