Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: Replace and ReplaceAll -- simple application

  • To: mathgroup at
  • Subject: [mg106457] Re: Replace and ReplaceAll -- simple application
  • From: AES <siegman at>
  • Date: Wed, 13 Jan 2010 05:58:25 -0500 (EST)
  • Organization: Stanford University
  • References: <> <hh72dp$kud$> <hh9vfo$1rk$> <> <hhf5kg$go6$> <> <hhkj1a$4tl$>

In article <hhkj1a$4tl$1 at>,
 Murray Eisenberg <murray at> 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 

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

  • Prev by Date: Re: horizontal line color
  • Next by Date: Re: Re: Radicals simplify
  • Previous by thread: Re: Replace and ReplaceAll -- simple application
  • Next by thread: Re: Re: Replace and ReplaceAll -- simple application