Re: Real and Complex Roots presented in a single plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg91847] Re: Real and Complex Roots presented in a single plot*From*: "David Park" <djmpark at comcast.net>*Date*: Wed, 10 Sep 2008 05:08:06 -0400 (EDT)*References*: <ga5koj$r82$1@smc.vnet.net>

Narasimham, I'll do your problem using the Presentations package. Needs["Presentations`Master`"] First I find your notation just a little jarring. z is usually used for the complex variable, x is usually the real part of a complex number and I'll use f for the function. f[z_] := 1.3 Sin[1.7 z] + 0.6 Sin[4 z] The easiest way to see the zeros is to make a contour plot of the modulus of the function. All the zeros occur in a narrow strip about the x-axis. With[ {zmin = -I, zmax = 18 + I, contourlist = {0, 0.1, 0.2, .5, 1, 2}}, Draw2D[ {ComplexCartesianContour[f[z], {z, zmin, zmax}, Abs, Contours -> contourlist, ColorFunctionScaling -> False, ColorFunction -> (ContourColors[contourlist, ColorData["SolarColors"]][#] &), PlotPoints -> {50, 15}, MaxRecursion -> 3, PlotRange -> {0, 4}]}, AspectRatio -> Automatic, Frame -> True, FrameLabel -> {Re, Im}, RotateLabel -> False, PlotLabel -> Row[{"Modulus of ", f[z]}], ImageSize -> 900] ] The following gives a closeup of the region that contains the first seven zeros. With[ {zmin = -.5 - I, zmax = 5 + I, contourlist = {0, 0.1, 0.2, .5, 1, 2, 10}}, Draw2D[ {ComplexCartesianContour[f[z], {z, zmin, zmax}, Abs, Contours -> contourlist, ColorFunctionScaling -> False, ColorFunction -> (ContourColors[contourlist, ColorData["SolarColors"]][#] &), PlotPoints -> {30, 15}, MaxRecursion -> 3, PlotRange -> {0, 11}]}, AspectRatio -> Automatic, PlotRange -> {{-.5, 5}, {-1, 1}}, Frame -> True, FrameLabel -> {Re, Im}, RotateLabel -> False, PlotLabel -> Row[{"Modulus of ", f[z]}], ImageSize -> 900] ] I might be happy with those diagrams, but if we want numerical root values we can click the root locations off the diagram, using DrawingTools, and then refine the values with FindRoot. roots = z /. FindRoot[ f[z], {z, ToComplex@#}] & /@ {{-0.005546, -0.02102}, {1.285, 0.3771}, {1.279, -0.3678}, {2.081, 0.01109}, {3.462, -0.008173}, {4.194, -0.3485}, {4.213, 0.345}} // Chop {0, 1.27946+ 0.374308 I, 1.27946- 0.374308 I, 2.09155, 3.43663, 4.19786- 0.355809 I, 4.19786+ 0.355809 I} The following then plots just the roots in the Argand plane. Draw2D[ {ComplexCirclePoint[#, 3, Black, Red] & /@ roots}, AspectRatio -> Automatic, PlotRange -> {{-.5, 5}, {-1, 1}}, Frame -> True, FrameLabel -> {Re, Im}, RotateLabel -> False, PlotLabel -> Row[{"Some Roots of ", f[z]}], BaseStyle -> {FontSize -> 12}, ImageSize -> 900] -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "Narasimham" <mathma18 at hotmail.com> wrote in message news:ga5koj$r82$1 at smc.vnet.net... > z[x_] = 1.3 Sin[1.7* x] + 0.6 Sin[4* x] ; > Plot[z[x], {x, 0, 18}] > > In the above plot we can see all the real roots of z very > approximately at {2.1,3.4, 5.5, 7.6, 9, 11, 13.1, 14.5, 16.5}, as the > curve crosses x-axis. > > We can also recognize and see the real parts of all the > complex roots of z where the curve is nearest to x -axis at {1.4, > 4.2, 6.6, 9.6, 12.3, 15.3, 17.7}. They are near to x-values where the > local maxima/minima occur.But we cannot 'see' their complex parts, as > they need to be computed. > > After computation of all real and complex roots I would like to > represent all roots, real and complex roots alike, on an ( x - y ) > Argand diagram (in a 2D plot) with the real part on x - axis and > imaginary part on y - axis. How to do this ? > > Regards, > Narasimham >