Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Change of Variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32521] Re: [mg32509] Change of Variables
  • From: Mianlai Zhou <lailai at nikhef.nl>
  • Date: Fri, 25 Jan 2002 02:57:51 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Thu, 24 Jan 2002, John S wrote:

> 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.
> 

I guess you should investigate more into the internal structure of
Mathematica. It is not so straight-forward as it is often assumed to be -
like the mathematical formulae. In fact, if you replace the test^2 in your
example to test, it will give beta. But since test^2 gives v^2/c^2, of
which the full form is:

In[1]:= FullForm[v^2/c^2] 
Out[1]:= Times[Power[c, -2], Power[v, 2]]

While the full form of v/c is

Out[2]:= Times[Power[c, -1], v]

Apparently they do not match each other. I mean, there is no sub-structure
of v/c in the expression v^2/c^2. Therefore, your replacement could not be
done. If you really want to do this replacement, you should change the
replacement rule to something like v -> c*beta.

However, in your original problem, there IS such sub-structure of
h*c/(lambda*k*T) in the expression. What you have to do is only, to 
replace the Replace[] to ReplaceAll[], because ReplaceAll is to transform 
each subpart of the expression, while Replace is only an attempt to 
transform the entire expression.

Good luck!

Mianlai Zhou
Theory Group, NIKHEF
Amsterdam, the Netherlands

  






  • Prev by Date: Re: memoizing functions
  • Next by Date: RE: Difference between Get[] and Copy-Past operation
  • Previous by thread: RE: Change of Variables
  • Next by thread: Re: Change of Variables