MathGroup Archive 2002

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

Search the Archive

Re: Change of Variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32512] Re: Change of Variables
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 25 Jan 2002 02:57:40 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <a2onns$5v9$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

what is the difference between Replace[] and ReplaceAll[] ?

??ReplaceAll

"expr /. rules applies a rule or list of rules in an attempt to
transform \
each subpart of an expression expr"

While 

??Replace

"Replace[expr, rules] applies a rule or list of rules in an attempt to \
transform the entire expression expr. Replace[expr, rules, levelspec]
applies \
rules to parts of expr specified by levelspec."

And

test^2 /. v -> c*beta

gives 

beta^2

and 

2*Pi*c^2*h/lambda^5*(E^(h*c/(lambda*k*T)) - 1)^(-1) /. 
  T -> h*c/(lambda*k x)

gives

(2*c^2*h*Pi)/((-1 + E^x)*lambda^5)

Regards
  Jens

John S wrote:
> 
> Hello,
> 
> I would greatly appreciate any help with the following problem.  I am trying
> to perform a change of variable in a function/definition so that I can
> integrate it.  In particular, I want to take Planck's Radiation Law:
> 
> planck=2*Pi*c^2*h/lambda^5*(E^(h*c/(lambda*k*T))-1)^(-1)
> 
> and substitute x=h*c/(lambda*k*T) and integrate wrt lambda from 0 to
> infinity.  I tried using replace, but that does not seem to try to
> manipulate the function in terms of x, but simply seek out the replacement,
> and if it exists, perform it.
> 
> An even simpler example is the following:
> 
> test=v/c
> Replace[test^2,v/c -> beta]
> 
> does not yield beta^2, but rather v^2/c^2.
> 
> Again, any and all help would be greatly appreciated.


  • Prev by Date: Re: memoizing function again
  • Next by Date: Re: Change of Variables
  • Previous by thread: Re: Change of Variables
  • Next by thread: NestWhile