MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: signs in the mathematica output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92507] Re: signs in the mathematica output
  • From: m.r at inbox.ru
  • Date: Thu, 2 Oct 2008 04:35:00 -0400 (EDT)
  • References: <gbulqi$lcr$1@smc.vnet.net> <gc0tp3$9hu$1@smc.vnet.net>

This might help:

In[1]:= expr = (a - 1)/(s - 1)

In[2]:= Module[{s}, expr /. -1 + x_ :> s (1 - x) /. s -> -1]

Out[2]= (1 - a)/(1 - s)

Maxim Rytin
m.r at inbox.ru

David Park wrote:
> The handling of signs under simplification is an annoying feature of
> Mathematica.
>
> Sometimes the result might look better if you display in TraditionalForm.
>
> Simplify[(1 - s) (1 - a)]
> % // TraditionalForm
> (-1 + a) (-1 + s)
> (a - 1) (s - 1)
>
> Otherwise you can Map Minus onto the two factors.
>
> Simplify[(1 - s) (1 - a)]
> Minus /@ %
> (-1 + a) (-1 + s)
> (1 - a) (1 - s)
>
> More generally what you have to do is Map Minus at the location of two
> factors. For example if we divide the two factors we could use:
>
> Simplify[(1 - s)/(1 - a)]
> MapAt[Minus, %, {{1, 1}, {2}}]
> (-1 + s)/(-1 + a)
> (1 - s)/(1 - a)
>
> But getting the positions of the two factors and straightening everything up
> can be something of a pain in the neck. Maybe someone else will have a
> better suggestion.
>
>
> --
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/
>
>
> "Simone Moriconi" <simone.moriconi at eco.unipmn.it> wrote in message
> news:gbulqi$lcr$1 at smc.vnet.net...
> > Hello everybody! I have a problem in using the Mathematica Package which
> > is probably a bit stupid but very annoying when you have long
> > expressions..
> >
> > When I "FullSimplify" big equations, in the output the negative sign is
> > always put aside i.e. if I do something like:
> >
> > FullSimplify[(1-s)(1-a)]
> >
> > I obtain
> >
> > (-1+s)(-1+a).
> >
> > Which is very confusing with long and tedius expressions. Does anybody
> > know a way to solve this problem?
> >
> > Thanks a lot for your help!!
> >


  • Prev by Date: Re: Variable question
  • Next by Date: RE: Comparison between Mathematica and other symbolic systems
  • Previous by thread: Re: signs in the mathematica output
  • Next by thread: differentiate/integrate a function