Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7586

Re: Rule replacement doesn't work after NDSolve?

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Rule replacement doesn't work after NDSolve?
Date 2012-01-05 10:57 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <je3vls$eao$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 1/4/12 at 5:03 AM, g.crlsn@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[3]:= Cos[y] /. Cos -> Sin

Out[3]= Sin[y]

replacing the Cos function with Sin or

In[4]:= Cos[y] /. y -> 2 x

Out[4]= 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[5]:= -2 I /. I -> -I

Out[5]= -2*I

since

In[6]:= FullForm[-2 I]

Out[6]//FullForm= Complex[0,-2]

and there is nothing to match the left hand side of the
replacement rule

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Rule replacement doesn't work after NDSolve? Bill Rowe <readnews@sbcglobal.net> - 2012-01-05 10:57 +0000
  Re: Rule replacement doesn't work after NDSolve? Szabolcs Horvát <szhorvat@gmail.com> - 2012-01-06 09:13 +0000

csiph-web