Re: Replace and ReplaceAll -- simple application
- To: mathgroup at smc.vnet.net
- Subject: [mg106457] Re: Replace and ReplaceAll -- simple application
- From: AES <siegman at stanford.edu>
- Date: Wed, 13 Jan 2010 05:58:25 -0500 (EST)
- Organization: Stanford University
- References: <200912270006.TAA12080@smc.vnet.net> <hh72dp$kud$1@smc.vnet.net> <hh9vfo$1rk$1@smc.vnet.net> <200912290618.BAA02632@smc.vnet.net> <hhf5kg$go6$1@smc.vnet.net> <200912310814.DAA24681@smc.vnet.net> <hhkj1a$4tl$1@smc.vnet.net>
In article <hhkj1a$4tl$1 at smc.vnet.net>,
Murray Eisenberg <murray at math.umass.edu> wrote:
> That's an instructive example on the point being discussed. As you note,
>
> R + I w L /. I -> -I
>
> works "as expected". But so does:
>
> I /. I -> -I
>
> What does NOT work is either of:
>
> R - I w L /. I -> -I
> -I /. I -> -I
>
What you say is certainly correct -- but I believe it bypasses the core
point. An individual with a physics background may manipulate the
impedance for an RL circuit by writing
R + I w L /. I -> -I
while one with an EE background may very naturally write this as
R + I 2 Pi f L /. I -> -I
(or, in many textbooks, R + 2Pi I L /. I -> -I)
And, **one of these will get a wrong answer**.
[And if this "erroneous" input is buried in a sequence of compound
expressions or definitions early in a notebook, that error may not even
become apparent until hours later, way down in the notebook, in the form
of bizarre and puzzling behavior in some much more complex derived
result.]
Same problem for two individuals, one of whom likes to use half width at
half maximum linewidths and writes a complex lorentzian as
1 + I (x-x0)/dxHwhm
and another who likes full width at half max linewidth, and so writes
1 + 2 I (x-x0)/dxFwhm
R + I w L/.I->-I
R + 2 Pi I f L/.I->-I
1+I ((x-x0)/deltax)^2/.I->-I
1+I (2(x-x0)/deltax)^2/.I->-I
- Follow-Ups:
- Re: Re: Replace and ReplaceAll -- simple application
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: Replace and ReplaceAll -- simple application