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

MathGroup Archive 2009

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

Search the Archive

Re: newbie question about inserting values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95526] Re: newbie question about inserting values
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 20 Jan 2009 06:58:14 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <gl4a2o$gco$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

try

test[4] /. test[n_] /; n > 0 :> n*test[(n - 1)]

and

test[4] //. test[n_] /; n > 0 :> n*test[(n - 1)]

Regards
   Jens

SaintPatrick wrote:
> Hello all,
> 
> Okay, take a look at this snippet from the book "Mathematica
> Navigator."
> '*****************************
> p = x + Sin[y];
> 
> 	Consider the following example
> 
> p/. x->y/.y->a
> 
> y+ Sin[a]
> 
> At each part of p, the rules are applied only once. Write then the
> following:
> 
> p/.x->y/.y->a
> 
> a+Sin[a]
> 
> First x is replaced with y, and then y is replaced with a. Mathematica
> also has the command ReplaceRepeated, which is formed by //.. It
> applies the rules until the result no longer changes:
> 
> p//.{x->y,y->a}
> 
> a+Sin[a]
> **********************************
> 
>  I'm having trouble understanding what the exact difference internally
> is between
> 
> p/.x->y/.y->a
> 
> and
> 
> p//.{x->y,y->a}
> 
> I'd appreciate some enlightenment.  Thanks.
> 
> 
> Patrick
> 


  • Prev by Date: Re: DO and LISTPLOT
  • Next by Date: Re: Multiple Shooting Method
  • Previous by thread: Re: DO and LISTPLOT
  • Next by thread: Re: Multiple Shooting Method