Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

another bug...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47651] another bug...
  • From: Enrique Zeleny <ezeleny at fismat1.fcfm.buap.mx>
  • Date: Tue, 20 Apr 2004 03:19:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,


In[1]:= expr = FunctionExpand[Cos[Pi/22]];

The next input doesn't work in 5.0, the expression that I want to replace
by a appears many times in expr

In[2]:= expr /. (1/2)*(-1 + Sqrt[5]) + I*Sqrt[2 - (1/2)*(-1 - Sqrt[5])] -> a

only works doing this

In[3]:= expr //. (1/2)*(-1 + Sqrt[5]) + I*Sqrt[2 - (1/2)*(m_)] -> a

If you look at FullForm

In[4]:= FullForm[(1/2)*(-1 + Sqrt[5]) + I*Sqrt[2 - (1/2)*(-1 - Sqrt[5])]]

Out[4]:= Plus[Times[Rational[1, 2], Plus[-1, Power[5, Rational[1, 2]]]],
  Times[Complex[0, 1],
    Power[Plus[2, Times[Rational[1, 2], Plus[1, Power[5, Rational[1, 2]]]]],
      Rational[1, 2]]]]

but if you copy and paste the result of expr and you use //.
(1/2)*(Sqrt[5] - 1) + I*Sqrt[(1/2)*(Sqrt[5] + 1) + 2] -> a to replace works well!!!

In Version 4.1 only this works well (but not in 5.0), but the expression
that appears many times is written with +'s

In[2]:= expr //. (1/2)*(-1 + Sqrt[5]) + I*Sqrt[2 + (1/2)*(1 + Sqrt[5])] ->
a

If you copy and paste the result of expr and you use only /. instead of
//. to replace (1/2)*(-1 + Sqrt[5]) + I*Sqrt[2 + (1/2)*(1 + Sqrt[5])] ->a
works fine!!!


Clearly the problem is recognizing

- (1/2)*(-1 - Sqrt[5])



Enrique Zeleny
Universidad Autonoma de Puebla
Mexico


  • Prev by Date: How to convert a flat scan of a 3D object, into a 3D picture in cylindrical coordinates?
  • Next by Date: RE: Kernel crash?
  • Previous by thread: Re: How to convert a flat scan of a 3D object, into a 3D picture in cylindrical coordinates?
  • Next by thread: Re: another bug...