Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: ReplaceAll problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84478] Re: ReplaceAll problem
  • From: Steven Siew <siewsk at bp.com>
  • Date: Thu, 27 Dec 2007 03:42:12 -0500 (EST)
  • References: <fkt9bf$6bi$1@smc.vnet.net>

On Dec 26, 9:10 pm, Kurda Yon <kurda... at yahoo.com> 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?

In[1]:=    res = -0.023243
             A2 = res

Out[1]= -0.023243

Out[2]= -0.023243

In[3]:=  Print["-1-> ", res];
            x = (res /. {A2 -> 0});
            Print["-2-> ", x];

           -1 -> -0.023243
           -2 -> 0



  • Prev by Date: Re: Re: Re: Re: how fill PolarPlot?
  • Next by Date: Re: Loading Packages in a loop
  • Previous by thread: Re: ReplaceAll problem
  • Next by thread: How to change style of notebook permanently?