Prev: SFTP
Next: calculating mean prediction bands
From: Murray Eisenberg on 25 Jun 2010 07:24 Comments interspersed in-line below... On 6/24/2010 4:27 AM, AES wrote: > In article<hvs7n2$8v0$1(a)smc.vnet.net>, > "David Park"<djmpark(a)comcast.net> wrote: > >> When working with complex expressions your best friend is the ComplexExpand >> command. For some reason, this command doesn't immediately jump to the >> notice of beginners and this leads to frequent questions on MathGroup. > > It doesn't immediately jump to the notice of beginners because: > > 1) Unlike familiar commands or functions or operators such as Sin, Cos, > Exp, SquareRoot, or even Re[-] or Im[-] or complex conjugate, there is > no such command or operator in "ordinary mathematics." > > No one _says_ "ComplexExpand" in ordinary mathematical discourse, and > the term would not have been encountered by the ordinary high school or > even college graduate. Many complex analysis problems in textbooks ask you to "express you answer in a + b i form". How would YOU name a Mathematical function to do that? I think "ComplexExpand" is a darned good rendering. > > 2) It's bizarrely named. SeriesExpand _expands_ into a series. > ComplexExpand[Re[expr]] trims, or selects. > I don't find anything "bizarre" about the naming. Compare, e.g., TrigExpand, PiecewiseExpand, PowerExpand. > 3) And, because of Mathematica's generally dysfunctional documentation > -- e.g. "ComplexExpand" is not even mentioned in tutorial/ComplexNumbers > and if it's mentioned in ref/Conjugate, it's buried somewhere down in > the nested and closed subsections and therefore cannot be _searched_ for > using any kind of Find command. > to somebody who is determined to prove that the Mathematica documentation is "dysfuncional", then probably it is. But somebody who wants to make use of the documentation instead of complain about it should have little trouble finding out about this. For example... - Open Documentation Center - Expand Mathematics and Algorithms - Select Numbers & Precision - Select Complex Numbers - Visually scan what's there - See "ComplexExpand - expand symbolic expressions into real and imaginary parts" - Select that function - Read about it: expand the More Information section; look at examples - From the Tutorials section on the ref/ComplexExpand page, select Expressions Involving Complex Variables - Read the page Or, here's another way, using search! - Open Documentation Center - do a search for "complex variables" - examine the search results - directly, or indirectly, select ComplexExpand from its abbreviated description; OR instead - select "Expressions Involving Complex Variables" > Would anyone suggest that the occurrence of "frequent questions on > MathGroup" might indicate a weakness, or even a product defect, in this > particular Mathematica design decision? No, I would NOT so suggest. Rather, I'd suggest an excellent design of a huge and complex system by very smart and savvy people coping with the limitations of the ordinary mortals who use it. An analyst I met in graduate school was fond of saying, "There are really only two topological spaces in which I believe: the real numbers and the complex numbers. And I'm not so sure about the real numbers!" -- Murray Eisenberg murray(a)math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
From: Daniel Lichtblau on 25 Jun 2010 07:24 AES wrote: > In article <hvs7n2$8v0$1(a)smc.vnet.net>, > "David Park" <djmpark(a)comcast.net> wrote: > >> When working with complex expressions your best friend is the ComplexExpand >> command. For some reason, this command doesn't immediately jump to the >> notice of beginners and this leads to frequent questions on MathGroup. > > It doesn't immediately jump to the notice of beginners because: > > 1) Unlike familiar commands or functions or operators such as Sin, Cos, > Exp, SquareRoot, or even Re[-] or Im[-] or complex conjugate, there is > no such command or operator in "ordinary mathematics." Ordinary mathematics generally has an implied context. And it does not have the vagaries of trying to guess how much work should be done to evaluate an expression. In Mathematica functions such as Re and Conjugate need to behave sensibly. Complexexpand is provided as a means to allow one some control over the outcome, ability to make assumptions about what variables are to be regarded as real, etc. I should mention also that it predates Assumptions and Refine. Those do not make ComplexExpand obsolete, but they sometimes provide an alternate route for handling the real-vs-complex realm. > No one _says_ "ComplexExpand" in ordinary mathematical discourse, and > the term would not have been encountered by the ordinary high school or > even college graduate. > > 2) It's bizarrely named. SeriesExpand _expands_ into a series. > ComplexExpand[Re[expr]] trims, or selects. (1) There is no Mathematica function "SeriesExpand". (2) ComplexExpand does in fact "expand" its argument into a sum of explicit real plus I times explicit imaginary parts. It certainly could have been given a different name, way back when. But the name it has it not by any means outrageously far from the mark, in terms of describing what it does. > 3) And, because of Mathematica's generally dysfunctional documentation > -- e.g. "ComplexExpand" is not even mentioned in tutorial/ComplexNumbers > and if it's mentioned in ref/Conjugate, it's buried somewhere down in > the nested and closed subsections and therefore cannot be _searched_ for > using any kind of Find command. I typed Complex in the Documentation Center pane. ComplexExpand showed up in the See Also links. I then typed "assume real" (sans quotes) and got multiple links. The seventh was to ComplexExpand. If I use quotes in that search I do not get ComplexExpand. But I do get a link to something called "Expressions Involving Complex Variables" (ninth link listed), and that discusses ComplexExpand. Moreover ComplexExpand is a See Also link from Conjugate. Also listed as a link from guide/ComplexNumbers. The list goes on. > Would anyone suggest that the occurrence of "frequent questions on > MathGroup" might indicate a weakness, or even a product defect, in this > particular Mathematica design decision? What you note above indicates possibly a weakness in documentation, though I have to say it does not look as though you made more than a token effort. (I'm being charitable, and assuming you did not find more and simply neglect to mention that). It certainly does not indicate a product defect. Of course there may well be defects in ComplexExpand, but nothing you mention shows the least sign of one. Daniel Lichtblau Wolfram Research
From: DBird on 25 Jun 2010 07:25 Thanks to all the replies to this query. The "general" problem I'm working on is to find the group delay of a "filter" expression. Using the ideas of the replies, the procedure that seems to work best for complicated expressions is as follows w/o M responses: Clear[T1, T2, C1, C2, R1, R2, w] $Assumptions = {T1, T2, C1, C2, R1, R2, w} \[Element] Reals && {T1 > 0, T2 > 0, C1 > 0, C2 > 0, R1 > 0, R2 > 0, w >= 0} H=expr Simplify[ComplexExpand[Im[H]]/ ComplexExpand[Re[H]]] Ang = ArcTan[%] GD = -Simplify[D[Ang, w]] Thanks again for all the replies. Dave On Jun 22, 4:00 am, DBird <db...(a)ieee.org> wrote: > Trying the following procedure: > > In[41]:= {T1, T2, C1, C2, R1, R2, w} \[Element] Reals > > Out[41]= (T1|T2|C1|C2|R1|R2|w)\[Element]\[DoubleStruckCapitalR] > > In[42]:= x = R1 + I 1/(w C1) > > Out[42]= R1+I/(C1 w) > > In[43]:= Im[x] > > Out[43]= Re(1/(C1 w))+Im(R1) > > Question is, how do I specify the list {T1,T2,...} such that Im[x] > yield just R1. > > I usually find I am missing something dumb... > > Thanks, > > Dave
From: David Park on 25 Jun 2010 07:27 Maybe ComplexExpand should have been called ComplexSimplify or ComplexReduce - but it's too late now and I don't know if that, in itself, would alleviate the problem for beginners. It's not that it's not readily accessible in the documentation. Using: ?*Complex* will bring it up on a short list. But will a beginner recognize it as useful? It is in the See Also section of most related Function pages. (Im, Re, Complex, Reals) But not Complexes. It is easy for beginners to ignore the items on See Also. If you enter "Complex" in the DC Search box, and then use "Search for all pages containing Complex" it also comes up on the list. But the real crux of the problem is the lack of basic information in the "More Information" notes and in the "Basic Examples". WRI tends to be too formalistic instead of putting examples of common usages. For example, on the Complex page, which will probably be the root page new users will look at, they write in the notes: "You can enter a complex number in the form x + I y." Of course, if you enter x + I y you will not obtain an expression with Head Complex but an expression. They should add "where x and y are numbers" - even though it is rather implied. Then they should add a note: "Symbolic expressions containing I will contain Complex numbers as subparts. Complex symbolic expressions can be simplified with ComplexExpand." Even though this is not formally part of the description of Complex, EVERYONE NEEDS TO KNOW IT. Then in the "Basic Examples" section they could add the examples: "Complex symbolic expressions will contain Complex numbers as subparts:" a + I b // FullForm Plus[a,Times[Complex[0,1],b]] "Complex symbolic expressions can be simplified with ComplexExpand." Im[a + I b] // ComplexExpand b Even though this isn't a direct formal description of Complex, it is such a common usage that users have to see it RIGHT AWAY. I bet that would go a long way to cutting down questions. David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: AES [mailto:siegman(a)stanford.edu] In article <hvs7n2$8v0$1(a)smc.vnet.net>, "David Park" <djmpark(a)comcast.net> wrote: > When working with complex expressions your best friend is the ComplexExpand > command. For some reason, this command doesn't immediately jump to the > notice of beginners and this leads to frequent questions on MathGroup. It doesn't immediately jump to the notice of beginners because: 1) Unlike familiar commands or functions or operators such as Sin, Cos, Exp, SquareRoot, or even Re[-] or Im[-] or complex conjugate, there is no such command or operator in "ordinary mathematics." No one _says_ "ComplexExpand" in ordinary mathematical discourse, and the term would not have been encountered by the ordinary high school or even college graduate. 2) It's bizarrely named. SeriesExpand _expands_ into a series. ComplexExpand[Re[expr]] trims, or selects. 3) And, because of Mathematica's generally dysfunctional documentation -- e.g. "ComplexExpand" is not even mentioned in tutorial/ComplexNumbers and if it's mentioned in ref/Conjugate, it's buried somewhere down in the nested and closed subsections and therefore cannot be _searched_ for using any kind of Find command. Would anyone suggest that the occurrence of "frequent questions on MathGroup" might indicate a weakness, or even a product defect, in this particular Mathematica design decision?
From: Helen Read on 25 Jun 2010 07:27
On 6/24/2010 4:43 AM, AES wrote: > > 3) And, because of Mathematica's generally dysfunctional documentation > -- e.g. "ComplexExpand" is not even mentioned in tutorial/ComplexNumbers > and if it's mentioned in ref/Conjugate, it's buried somewhere down in > the nested and closed subsections and therefore cannot be _searched_ for > using any kind of Find command. It's really not that hard to find. I just tried searching the Documentation for "complex numbers". The first two hits are "Complex" and "Numbers". The third on the list, highlighted with a nice orange bullet, is "Complex Numbers". This takes you directly to guide/ComplexNumbers, which has all the basic functions for working with complex numbers, including this: ComplexExpand -- expand symbolic expressions into real and imaginary parts Seems pretty clear to me. -- Helen Read University of Vermont |