From: Joe Gwinn on 8 Mar 2010 06:14 David, At 9:30 AM -0500 3/7/10, David Park wrote: > >Have you tried ComplexExpand? It assumes that all symbols are Reals, unless >specified otherwise. Also check its TargetFunctions option. I had tried ComplexExpand some time ago and had forgotten it, because it too overachieved, yielding trig. A number of people have suggested it in response to my query, so I tried it again. I just tried TargetFunctions, but Exp isn't an allowed function, and {Re,Im} allowed the trig answers. What seems to work is ComplexExpand[]//TrigToExp. Thanks, Joe >David Park >djmpark(a)comcast.net >http://home.comcast.net/~djmpark/ > > > > >From: Joseph Gwinn [mailto:joegwinn(a)comcast.net] > >I have been using Mathematica 7 to do the grunt work in solving some >transmission-line problems, using the exponential form of the equations. > >A typical form would be S1 = Exp[k1*x + I*omega*(t+tau)], describing signal >one, >where K1 is the attenuation in nepers per meter, I is the square root of >minus >one, omega is the angular frequency in radians per second, t is time and tau >is >a fixed time delay, t and tau being in seconds. > >Often I need the complex conjugate of S1, so I write Conjugate[S1]. The >problem >is that Mathematica does nothing useful, leaving the explicit Conjugate[] in >the >output expression, which after a very few steps generates a mathematically >correct but incomprehensible algebraic hairball. > >Clearly Mathematica feels that it lack sufficient information to proceed. >In >particular, it has no way to know that all variables are real until >explicitly >told. > >One way to solve this problem is >FullSimplify[Conjugate[S1],Element[_Symbol,Reals]], and this often works. > >But equally often, it works too well, yielding the trignometric expansion of >the >desired exponential-form answer. Nor is it clear why it sometimes works and > >sometimes works too well. > >Using Simplify[] instead of FullSimplify[] doesn't seem to work at all. > > >So my questions are: > >1. What controls FullSimplify[]'s behaviour here? > >2. What other ways are there to cause Mathematica to apply the Conjugate[] >without holding back? > > >Thanks, > >Joe Gwinn
From: Bob Hanlon on 8 Mar 2010 06:19 Use ComplexExpand S1 = Exp[k1*x + I*omega*(t + tau)]; S1 // Conjugate E^Conjugate[I*omega*(t + tau) + k1*x] S1 // Conjugate // ComplexExpand E^(k1*x)*Cos[omega*(t + tau)] - I*E^(k1*x)*Sin[omega*(t + tau)] S1 // Conjugate // ComplexExpand // FullSimplify E^(k1*x - I*omega*(t + tau)) Bob Hanlon ---- Joseph Gwinn <joegwinn(a)comcast.net> wrote: ============= I have been using Mathematica 7 to do the grunt work in solving some transmission-line problems, using the exponential form of the equations. A typical form would be S1 = Exp[k1*x + I*omega*(t+tau)], describing signal one, where K1 is the attenuation in nepers per meter, I is the square root of minus one, omega is the angular frequency in radians per second, t is time and tau is a fixed time delay, t and tau being in seconds. Often I need the complex conjugate of S1, so I write Conjugate[S1]. The problem is that Mathematica does nothing useful, leaving the explicit Conjugate[] in the output expression, which after a very few steps generates a mathematically correct but incomprehensible algebraic hairball. Clearly Mathematica feels that it lack sufficient information to proceed. In particular, it has no way to know that all variables are real until explicitly told. One way to solve this problem is FullSimplify[Conjugate[S1],Element[_Symbol,Reals]], and this often works. But equally often, it works too well, yielding the trignometric expansion of the desired exponential-form answer. Nor is it clear why it sometimes works and sometimes works too well. Using Simplify[] instead of FullSimplify[] doesn't seem to work at all. So my questions are: 1. What controls FullSimplify[]'s behaviour here? 2. What other ways are there to cause Mathematica to apply the Conjugate[] without holding back? Thanks, Joe Gwinn
From: John Feth on 8 Mar 2010 06:21 On Mar 7, 2:12 am, Joseph Gwinn <joegw...(a)comcast.net> wrote: > I have been using Mathematica 7 to do the grunt work in solving some > transmission-line problems, using the exponential form of the equations. > > A typical form would be S1 = Exp[k1*x + I*omega*(t+tau)], describing signal one, > where K1 is the attenuation in nepers per meter, I is the square root of minus > one, omega is the angular frequency in radians per second, t is time and tau is > a fixed time delay, t and tau being in seconds. > > Often I need the complex conjugate of S1, so I write Conjugate[S1]. The problem > is that Mathematica does nothing useful, leaving the explicit Conjugate[] in the > output expression, which after a very few steps generates a mathematically > correct but incomprehensible algebraic hairball. > > Clearly Mathematica feels that it lack sufficient information to proceed. In > particular, it has no way to know that all variables are real until explicitly > told. > > One way to solve this problem is > FullSimplify[Conjugate[S1],Element[_Symbol,Reals]], and this often works. > > But equally often, it works too well, yielding the trignometric expansion of the > desired exponential-form answer. Nor is it clear why it sometimes works and > sometimes works too well. > > Using Simplify[] instead of FullSimplify[] doesn't seem to work at all. > > So my questions are: > > 1. What controls FullSimplify[]'s behaviour here? > > 2. What other ways are there to cause Mathematica to apply the Conjugate[] > without holding back? > > Thanks, > > Joe Gwinn Joe, I struggled with Mathematica's sometimes obscure treatment of complex numbers and one morning several years ago after massive coffee fortification, I managed to force output sensible to mere humans. The expressions below work for individual complex expresssions and also (massive) Jones matrices. Intensity[expr_] := TrigReduce[ ExpToTrig[ expr*TrigToExp[ComplexExpand[Conjugate[ExpToTrig[expr]]]]]]; conj[expr_] := TrigToExp[ComplexExpand[Conjugate[ExpToTrig[expr]]]]; It looks pretty clumsy, but it is very fast and always gives intelligible results. It works with all versions of Mathematica from 5.2 through 7. Drop me a line and I'll send you a notebook with some optical circuits. Regards, John Feth
From: Joseph Gwinn on 9 Mar 2010 06:26 In article <hn2m1k$3pc$1(a)smc.vnet.net>, AES <siegman(a)stanford.edu> wrote: > In article <hmvqlg$1gg$1(a)smc.vnet.net>, > Joseph Gwinn <joegwinn(a)comcast.net> wrote: > > > A typical form would be S1 = Exp[k1*x + I*omega*(t+tau)], describing > > signal one, where K1 is the attenuation in nepers per meter, I is the > > square root of minus one, omega is the angular frequency in radians > > per second, t is time and tau is a fixed time delay, t and tau being > > in seconds. > > > > Often I need the complex conjugate of S1, so I write Conjugate[S1]. > > You don't know what a firestorm you may ignite with this query. No incoming fire so far, but lots of helpful advice. Most people suggested ComplexExpand, which also reverts to trig seemingly at random, but what does solve my immediate problem is: ComplexExpand[...]//TrigToExp. > How would you do this on paper? All the other factors in your > expression you know are going to be purely real, so you really > just want to change I to -I, right? (How else does one take a > CC in the real world?) All parameters and variables are real. This is known from the physics. > And so in Mathematica you might write > > S1Complex = S1 /. {I -> -I} > > If you try this, you'll find that sometimes it works just fine -- and > sometimes it doesn't -- and Mathematica gives you no warning > anywhere in the elementary discussions of /. or -> or I that you > shouldn't do this, or why you shouldn't. What's there for Mathematica to complain about? It did _exactly_ as instructed, human! > So don't do it this way (but don't expect a lot of sympathy from > this group for people doing elementary phasor analyses like > you're doing, who are misled by this line of thinking). I did think of this, but am generically afraid of using syntactic rewrite rules on mathematical expressions unless I have been able to prove the semantic (mathematical) correctness of the transform when applied over all possible expressions, however complex. It isn't enough that the rewrite rule work with the expression as presented, as Mathematica will translate the expression into various internal representations, and these representations vary seemingly at random. Joe Gwinn
From: Joseph Gwinn on 9 Mar 2010 06:26 In article <hn2mjv$49t$1(a)smc.vnet.net>, John Feth <johnfeth(a)gmail.com> wrote: > On Mar 7, 2:12 am, Joseph Gwinn <joegw...(a)comcast.net> wrote: > > I have been using Mathematica 7 to do the grunt work in solving some > > transmission-line problems, using the exponential form of the equations. > > > > A typical form would be S1 = Exp[k1*x + I*omega*(t+tau)], describing signal > > one, > > where K1 is the attenuation in nepers per meter, I is the square root of > > minus > > one, omega is the angular frequency in radians per second, t is time and > > tau is > > a fixed time delay, t and tau being in seconds. > > > > Often I need the complex conjugate of S1, so I write Conjugate[S1]. The > > problem > > is that Mathematica does nothing useful, leaving the explicit Conjugate[] > > in the > > output expression, which after a very few steps generates a mathematically > > correct but incomprehensible algebraic hairball. > > > > Clearly Mathematica feels that it lack sufficient information to proceed. > > In > > particular, it has no way to know that all variables are real until > > explicitly > > told. > > > > One way to solve this problem is > > FullSimplify[Conjugate[S1],Element[_Symbol,Reals]], and this often works. > > > > But equally often, it works too well, yielding the trignometric expansion > > of the > > desired exponential-form answer. Nor is it clear why it sometimes works > > and > > sometimes works too well. > > > > Using Simplify[] instead of FullSimplify[] doesn't seem to work at all. > > > > So my questions are: > > > > 1. What controls FullSimplify[]'s behaviour here? > > > > 2. What other ways are there to cause Mathematica to apply the Conjugate[] > > without holding back? > > > > Thanks, > > > > Joe Gwinn > > Joe, > > I struggled with Mathematica's sometimes obscure treatment of complex > numbers and one morning several years ago after massive coffee > fortification, I managed to force output sensible to mere humans. The > expressions below work for individual complex expresssions and also > (massive) Jones matrices. > > > Intensity[expr_] := > TrigReduce[ > ExpToTrig[ > expr*TrigToExp[ComplexExpand[Conjugate[ExpToTrig[expr]]]]]]; > > conj[expr_] := TrigToExp[ComplexExpand[Conjugate[ExpToTrig[expr]]]]; > > > It looks pretty clumsy, but it is very fast and always gives > intelligible results. It works with all versions of Mathematica from > 5.2 through 7. Drop me a line and I'll send you a notebook with some > optical circuits. I have to wonder if "conj[expr_]:=ComplexExpand[Conjugate[expr]]//TrigToExp" would work for your application, or if not, why? I don't recall what was available in version 5.2, and there may be simpler solutions available in version 7. Massive Jones Matricies are far more complex than what I'm doing, and so may make for a good test case. Joe Gwinn
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Solving ODE with discontinuous shock perturbation [was: Modification Next: Remote Kernel |