Re: Change of Variables
- To: mathgroup at smc.vnet.net
- Subject: [mg32520] Re: [mg32509] Change of Variables
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 25 Jan 2002 02:57:50 -0500 (EST)
- References: <200201241021.FAA06071@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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. Ordinary replacement depends heavily on syntactic structure. For example, if you do FullForm[v/c] and FullForm[test^2] you will find that the former pattern does not appear within the latter (due to the way products of powers evaluate). A more powerful approach to polynomial-type replacement is to use polynomial reduction technology. I'll start with the second example. It can be handled with PolynomialReduce by providing a suitable reduction relation, v-c*beta, and a suitable variable ordering, say v>c>beta. In[26]:= InputForm[PolynomialReduce[(v/c)^2, v-c*beta, {v,c,beta}] [[2]]] Out[26]//InputForm= beta^2 To do something similar with the more complicated expression you might map a polynomial reduction over subparts that are rational functions in the variables. The code below will do this. I am not at all certain that the result is quite what you have in mind, but if not it may provide clues as to what to do to get your desired result. replacementFunction[expr_,rep_,vars_] := If [ PolynomialQ[Numerator[expr],vars] && PolynomialQ[Denominator[expr],vars], PolynomialReduce[expr, rep, vars][[2]], expr] In[29]:= InputForm[MapAll[replacementFunction[#, x*lambda*k*T-h*c,{h,c,lambda,k,T,x}]&, planck]] Out[29]//InputForm= (2*c^2*h*Pi)/((-1 + E^x)*lambda^5) Daniel Lichtblau Wolfram Research
- References:
- Change of Variables
- From: "John S" <bosniajohns@hotmail.com>
- Change of Variables