Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1990
*January
*February
*March
*April
*May
*June
*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 1990

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

Search the Archive

replace by value in expr

  • To: mathgroup at yoda.ncsa.uiuc.edu (Mathematica)
  • Subject: replace by value in expr
  • From: cnh5730 at maraba.tamu.edu (Charles Herrick)
  • Date: Wed, 12 Dec 90 14:38:19 CST

Reference Wolfram's book Section 1.4.4 pgs 54-55
Regarding:
expr /. x -> value 

"replace x by value in the expression expr"
Are there some weird precedence rules I haven't found yet,
or is this a bug (well, perhaps a feature)?
I get:

In[n]:= x = .;
In[n+1]:= 1 + x^2 /. x -> 1+a
Out[n+1]:= 1 + (1 + a)^2
In[n+2]:= x = 3;
In[n+3]:= 1 + x^2 /. x -> 1+a
Out[n+3]:= 10
In[n+4]:= x = 5;
In[n+5]:= 5 + x /. x -> 3
Out[n+5]:= 10
In[n+6]:= 5 + (x /. x -> 3)
Out[n+6]:= 8
In[n+7]:= x = 3;
In[n+8]:= 1 + (x^2 /. x -> 1+a)
Out[n+8]:= 10

I'm on 

NeXT Release 1.0
Mma kernel version 1.2  

front-end version 1.2 

(Initial NeXT version)


  • Prev by Date: Power[] corrupts, Absolute[Power[]] corrupts absolutely
  • Next by Date: Bug in Plot (PlotLabel)
  • Previous by thread: Power[] corrupts, Absolute[Power[]] corrupts absolutely
  • Next by thread: Re: replace by value in expr