MathGroup Archive 2007

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

Search the Archive

Re: ReplaceAll problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84475] Re: ReplaceAll problem
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Thu, 27 Dec 2007 03:40:37 -0500 (EST)
  • References: <fkt9bf$6bi$1@smc.vnet.net>

Kurda Yon wrote:
> Hi,
> 
> I have the following code
> 
> Print["-1-> ", res];
> x = (res /. {A2 -> 0});
> Print["-2-> ", x];
> 
> which outputs the following
> 
> -1-> -0.023243
> -2-> 0
> 
> As we can see from the first Print-output, "res" is just a real
> number. It does not contain the A2. So, why the replacement of A2 by
> zero should change the "res" value?  By the way x = (res /. {A2 -> 0})
> returns -0.023243.
> 
> Could you pleas help me to solve the problem?
> 

Most probably A2 had the same value as res.

In[1]:= res = 3
Out[1]= 3

In[2]:= res /. A2 -> 0
Out[2]= 3

In[3]:= A2 = 3
Out[3]= 3

In[4]:= res /. A2 -> 0
Out[4]= 0

--
Szabolcs


  • Prev by Date: Re: Avoid slow initialization of DynamicModule
  • Next by Date: Re: ReplaceAll problem
  • Previous by thread: ReplaceAll problem
  • Next by thread: Re: ReplaceAll problem