Re: Rule replacement doesn't work after NDSolve?
- To: mathgroup at smc.vnet.net
- Subject: [mg124004] Re: Rule replacement doesn't work after NDSolve?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 5 Jan 2012 05:56:05 -0500 (EST)
- Delivered-to: email@example.com
On 1/4/12 at 5:03 AM, g.crlsn at gmail.com (gac) wrote: >Thanks very much for the reply. Your suggestion works as you say, >but I'm still confused. I thought that the replacement is for the >function, not the arguments. Replacement rules are not limited to either functions or arguments. For example, I can do: In:= Cos[y] /. Cos -> Sin Out= Sin[y] replacing the Cos function with Sin or In:= Cos[y] /. y -> 2 x Out= Cos[2*x] replacing the argument y with 2 x The thing to keep in mind with replacement rules is a litteral match is made between the FullForm of the expression you want to operate on and the left hand side of the replacement rule. For example, this does nothing: In:= -2 I /. I -> -I Out= -2*I since In:= FullForm[-2 I] Out//FullForm= Complex[0,-2] and there is nothing to match the left hand side of the replacement rule