Re: complex analysis problem in mathematica 3.0
- To: mathgroup at smc.vnet.net
- Subject: [mg48636] Re: complex analysis problem in mathematica 3.0
- From: Sotirios Bonanos <sbonano at inp.demokritos.gr>
- Date: Wed, 9 Jun 2004 04:16:53 -0400 (EDT)
- Organization: National Technical University of Athens, Greece
- References: <c9ec75$g9q$1@smc.vnet.net> <c9haqn$1b8$1@smc.vnet.net> <c9k4dl$fim$1@smc.vnet.net>
- Reply-to: sbonano at inp.demokritos.gr
- Sender: owner-wri-mathgroup at wolfram.com
BranasMan wrote: > On Tue, 1 Jun 2004 07:21:59 +0000 (UTC) > klishko at mail.ru (Alex Klishko) > wrote: > > >I think, it confuses because of a variable w may also be a comlex number. > >If w is a real try ComplexExpand -fuction. > >For example: > > > >H = 1 / (s^3 + 2s^2 + 2s + 1) /. s -> \jw > >ComplexExpand[%] > > w IS real,but i can't get mathematica to see that, and when i do > ComplexExpand[%] i get the following: > > (1/Abs[1 + 2Iw - 2w^2 - Iw^3]^2 - > (2Iw)/Abs[1 + 2Iw - 2w^2 - Iw^3]^2 - > (2w^2)/Abs[1 + 2Iw - 2w^2 - Iw^3]^2 + > (Iw^3\)/Abs[1 + 2Iw - 2w^2 - Iw^3]^2) > > does anybody manage to get this thing right? > i'm a little lost... I have found it very useful to define a function Bar[x_] to give the complex-conjugate of any expression x, and use it to define my own Re, Im and Abs functions. The definition of Bar is in terms of a set of rules, which can be modified to accommodate the symbols/expressions one uses. Copy and paste the text beginning with (*************) below in a new Mathematica notebook to see 2 examples of what I mean. Using either definition, the functions myRe[h[I w]], myIm[h[I w]], where h[s_] = 1/(s^3 + 2s^2 + 2s + 1), give the required simplified expressions. S. Bonanos http://www.inp.demokritos.gr/~sbonano/ (*************) Notebook[{ Cell[BoxData[ \( (**\ Define\ complex\ conjugate\ operation\ \*"\""Bar \*"\"\<\> "**) \)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(SetAttributes[Bar, {Listable}]; \nBar[Bar[x_]] = x; \n Bar[Complex[u_, v_]] := Complex[u, \(-v\)]; \n Bar[x_Plus | x_Times | x_Power | x_Rule | x_Equal] := Bar/@x; \)], "Input"], Cell[BoxData[ \(\( (**\ Case\ I : \ All\ symbols\ used\ are\ real\ **) \n \(Bar[x_] := x; \)\)\)], "Input"], Cell[BoxData[ \(\n\)], "Input"], Cell[BoxData[ \( (*\(*\ Use\ Bar\ to\ define\ Re\), \ Im, \ Abs\ **) \)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(\(myRe[x_] := Simplify[\((x + Bar[x])\)/2]; \)\)], "Input"], Cell[BoxData[ \(\(myIm[x_] := Simplify[\((x - Bar[x])\)/\((2 I)\)]; \)\)], "Input"], Cell[BoxData[ \(\(myAbs[x_] := PowerExpand[Sqrt[Simplify[myRe[x]^2 + myIm[x]^2]]]; \)\)], "Input"], Cell[BoxData[ \(\n\)], "Input"], Cell[BoxData[ \( (**\ EXAMPLES\ **) \)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(myRe[\((x + I\ y)\)^3]\)], "Input"], Cell[BoxData[ \(x\^3 - 3\ x\ y\^2\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(myIm[\((x + I\ y)\) + a^2/\((x + I\ y)\)]\)], "Input"], Cell[BoxData[ \(\(y\ \((\(-a\^2\) + x\^2 + y\^2)\)\)\/\(x\^2 + y\^2\)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(myAbs[a \((x - a + I\ y)\) + I\ b \((y - b + I\ x)\)]\)], "Input"], Cell[BoxData[ \(\@\(\((a\^2 - a\ x + b\ x)\)\^2 + \((\(-b\^2\) + a\ y + b\ y)\)\^2\)\)], "Output"] }, Open ]], Cell[BoxData[ \(\(\n\n\)\)], "Input"], Cell[BoxData[ \( (**\ Case\ II : \ Complex\ symbols\ have\ the\ form\ z[i_]\ **) \)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(\(Clear[Bar]; \)\)], "Input"], Cell[BoxData[ \(SetAttributes[Bar, {Listable}]; \nBar[Bar[x_]] = x; \n Bar[Complex[u_, v_]] := Complex[u, \(-v\)]; \n Bar[x_Plus | x_Times | x_Power | x_Rule | x_Equal] := Bar/@x; \)], "Input"], Cell[BoxData[ \(\(Bar[x_] := x /; Head[x] =!= z; \)\)], "Input"], Cell[BoxData[ \(\n\)], "Input"], Cell[BoxData[ \( (**\ THEN\ **) \)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(myRe[z[1] + I\ z[2]]\)], "Input"], Cell[BoxData[ \(1\/2\ \((Bar[z[1]] - I\ Bar[z[2]] + z[1] + I\ z[2])\)\)], "Output"] }, Open ]], Cell[BoxData[ \(\(zTOxy = {z[1] -> x1 + I\ y1, z[2] -> x2 + I\ y2}; \)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(Together[%% /. %]\)], "Input"], Cell[BoxData[ \(x1 - y2\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(myIm[z[1]^2 + I\ z[2]^2 /. zTOxy]\)], "Input"], Cell[BoxData[ \(x2\^2 + 2\ x1\ y1 - y2\^2\)], "Output"] }, Open ]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 1024}, {0, 748}}, WindowSize->{956, 721}, WindowMargins->{{4, Automatic}, {Automatic, 2}}, MacintoshSystemPageSetup->"\<\ 00000000000000000NHh00000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000\>" ]