MathGroup Archive 2010

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

Search the Archive

Re: Replace and ReplaceAll -- simple application


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


  • 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