Re: Replace and ReplaceAll -- simple application
- To: mathgroup at smc.vnet.net
- Subject: [mg106038] Re: Replace and ReplaceAll -- simple application
- From: AES <siegman at stanford.edu>
- Date: Thu, 31 Dec 2009 03:14:13 -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>
In article <hhf5kg$go6$1 at smc.vnet.net>,
Murray Eisenberg <murray at math.umass.edu> wrote:
[Re the I -> -I problem in particular:]
> On the other hand, not every possible issue can be addressed immediately
> at the top of documentation just because this or that user happened to
> experience some difficulty with it.
>
> Only gathering usage statistics, or having a focus group of users trying
> stuff, might suffice to escalate some issues to the point of requiring
> more prominent warnings.
>
> I wonder how many users in fact experience this issue.
I'll give you one sizable group.
Engineering and science students and practitioners, at all levels down
to at least college sophomores and even advanced high school students,
are taught to solve systems of coupled linear differential equations
(e.g., the loop or node equations for linear electrical networks with
current and/or voltage sources, or forcing functions) using the phasor
approach.
The first step in doing this is of course to replace d^n /dt^n by
(I w)^n (w as shorthand for omega), thereby converting these to coupled
algebraic equations. The next step is then to solve these equations to
obtain a matrix-valued transfer function or scattering matrix, whose
elements contain only *real-valued* parameters (R's, L's and C's in the
electrical circuit case) and I -- elements that look like R + I w L.
In practice, the instructor and the students do a few problems of this
type by hand, with just one or two variables; define and examine the
poles and zeros of the transfer function; learn about concepts like
resonance and impedance and admittance, and scattering matrices and
input and output ports; and so on. But the instant one goes to anything
more realistic and interesting, with three or more variables, the
algebra and the numerical calculations just become too tedious.
But, hey, Mathematica is just beautiful for this task. The Solve[ ]
function is perfect for doing the algebra to find the transfer function
-- simple, easy to understand, obvious; and all the elementary Plot
functions (David Park's "set pieces") will give you all the plots you
could ask for. And since the output variables are phasors, e.g.
voltages and currents, vc(t) and ic(t) (generally indexed and often
written with superimposed tildes to indicate that they are complex
variables), you can get numerical results for power flows and energy
densities using notations like p([t_] = Re[vc(t)] Re[ic(t)].
But at some point you may want to get analytical formulas as well, e.g.
the modulus and argument of the transfer function from an input to an
output port. And, maybe move on to the ideas of "lossless", that is,
unitary, and Hermitian scattering matrices. At which point, the idea of
the transfer function, call it tFunc, and its complex conjugate,
tFunctStar, become significant. EE students say "v" and "vStar" and "i"
and "iStar" all the time!
And at that point, if you're focusing on the system properties and not
specific numerical calculations it's very tempting to note that these
tFunc's contain nothing but purely real circuit elements (R's. L's and
C's, or masses and spring constants, or whatever), and I.
And a quick test confirms that the rule {a->-a} does what it's supposed
to (whether or not a has a minus sign in front of it). Or, a quick test
confirms that I->-I properly converts R + I w L into R - I w L. Why
shouldn't it??? It just does what you'd expect a global find and
replace to do, or what you'd do "by hand" -- right?
Take a look at the Mathworld entries for "phasor" and "transfer
function" and see how far down you'd have to dig to get an explicit
warning that the previous paragraph is misleading. (And note that the
entry for "Phasor" does not contain a "SEE ALSO:" for the term "Complex
Conjugation", and the link to that term within the text does not -- so
far as I can see -- give any hint the the rule I->-I will fail for an
expression containing -I.)
- References:
- Replace and ReplaceAll -- simple application
- From: amannuc1 <Anthony.J.Mannucci@jpl.nasa.gov>
- Re: Replace and ReplaceAll -- simple application
- From: AES <siegman@stanford.edu>
- Replace and ReplaceAll -- simple application