Puzzled over (un)changing argument symbols in functions
- To: mathgroup at smc.vnet.net
- Subject: [mg27957] Puzzled over (un)changing argument symbols in functions
- From: "A. E. Siegman" <siegman at stanford.edu>
- Date: Mon, 26 Mar 2001 05:27:05 -0500 (EST)
- Organization: Stanford University
- Sender: owner-wri-mathgroup at wolfram.com
Here are three cells just to confirm that if I define a trivial function
f1[y,z], then substitute y1 and z1 for y and z, the result is what you'd
think it would be
In[1] := f1[y_, z_] := y - z;
In[2] := f1[y, z]
Out[2] = y - z
In[3] := f1[y1, z1]
Out[3] = y1 - z1
Now I define a slightly more complex but still algebraic function
f2[n,b] using RSolve. For simplicity I haven't printed the Outputs
below, but the essential result is that b is *not* replaced by b1 in
Output[] -- Outputs [7] and [8] are identical:
In[4] := << DiscreteMath`RSolve`;
In[5] := fSoln = RSolve[ { a[n] == (2 + b)a[n - 1] - a[n - 2],
a[3] == 1, a[-3] == 1}, a[n], n ] /. (n ? -3) ->True;
In[6] := f2[n_, b_] := (a[n] /. fSoln[[1]]);
In[7]:= f2[n, b]
In[8]:= f2[n, b1]
Why doesn't f2[n,b] behave like f1[y,x] did?