MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Real and Complex Roots presented in a single plot

  • To: mathgroup at
  • Subject: [mg92484] Re: [mg91820] Real and Complex Roots presented in a single plot
  • From: Murray Eisenberg <murray at>
  • Date: Wed, 1 Oct 2008 18:32:53 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <>
  • Reply-to: murray at

Here's some suggestions.

First, since the roots of the function include complex numbers, it's
better to call the input variable z, and then use a different name for
the function.

Second, you might have better luck if you rationalize the coefficients,
solve "exactly", then take the numerical values of the exact roots
found.  That way you won't have to do lots of FindRoot instances.

Third, it seems to me that plotting the real and imaginary parts of each
root separately, on the x- and y-axes, respectively, will not be very
enlightening unless all you're interested in is those real and imaginary
parts:  you won't be able to tell which real part goes with which
imaginary part.  So I also suggest that you plot the complex points
themselves.  If you want, in addition, to plot the real and imaginary
parts of each on an axis, that should now be simple to add to the plot.

    f[z_] := (13/10) Sin[(17/10) z] + (6/10) Sin[4 z]
    roots = z /. Solve[f[z] == 0, z]
    nRoots = N /@ roots
    xyPairs = nRoots /. Complex[a_, b_] -> {a, b}

Narasimham wrote:
> 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

Murray Eisenberg                     murray at
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

  • Prev by Date: Re: fellow authors
  • Next by Date: Re: fellow authors
  • Previous by thread: Re: fellow authors
  • Next by thread: Re: command line options: -initfile vs -run