MathGroup Archive 1999

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

Search the Archive

Re: Re: Simplifying constants...bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18619] Re: [mg18559] Re: [mg18489] Simplifying constants...bug?
  • From: "Wolf, Hartmut" <hwolf at debis.com>
  • Date: Tue, 13 Jul 1999 01:01:37 -0400
  • Organization: debis Systemhaus
  • References: <7m3l22$shp@smc.vnet.net> <199907100618.CAA03008@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello Alan

calvitti at boes.ces.cwru.edu schrieb:
> 
> here's some intersting behavior in 3.0:
> 
>     (a + c*d)/(b + c*d) //. c*d -> -z
> 
> gives (as expected):
> 
>     (a - z)/(b - z)
> 
> yet
> 
>     (a + c*d)/(c*d) //. c*d -> -z
> 
> no longer simplifes the denominator:
> 
>     (a+b-z)/(c*d)
> 
> anyone know why?
> 
Well Alan, this is a very common problem, when using Mathematica. 
What you input (and think) is not always what you get. To see that (and
to get used thinking in Mathematica structures, I recommend to often) look at
the expression with FullForm:

In[3]:= (a + c*d)/(c*d) //FullForm
Out[3]//FullForm=
Times[Power[c,-1],Power[d,-1],Plus[a,Times[c,d]]]

So Times[c,d] can't match the 'denominator' (there is no division in
Mathematica!). Knowing that you can try:

In[4]:= (a + c*d)/(c*d) //. {c*d -> -z, 1/(c*d)->-1/z}

admitted ...that's ugly. See, the following also won't work :

In[10]:= a+(c*d)^5 /. c*d-> -z
Out[10]= a + c^5*d^5

But that will help you a little bit further:

In[18]:= (a + c*d)/(c*d) //. c^n_. * d^n_. :> (-z)^n
Out[18]= -((a - z)/z)

In[19]:= a + (c*d)^5 /. c^n_. * d^n_. :> (-z)^n
Out[19]= a - z^5

---regards, hw



  • Prev by Date: Re: Livegraphics3D
  • Next by Date: Re: Re: Simplifying constants...bug?
  • Previous by thread: Re: Re: Simplifying constants...bug?
  • Next by thread: Re: Re: Simplifying constants...bug?