Re: Searching list for closest match to p
- To: mathgroup at smc.vnet.net
- Subject: [mg79341] Re: Searching list for closest match to p
- From: chuck009 <dmilioto at comcast.com>
- Date: Wed, 25 Jul 2007 02:05:21 -0400 (EDT)
Thanks Peter. That's nice code you wrote. I do lots of work with complex variables. The construct:
Through[{Re,Im}[#]] & @@@
I'll find useful. I see your code relies on Pick. Didn't know about that one. That's helpful to know. Also the Epilog construct in ListPlot is nice: doesn't require the Graphics prefix I see.
>
> Maybe this version using Pick[] is more pleasant?
>
> p3color = Red;
> circleColor = Blue;
> p3 = Exp[I*Pi/3];
> s100 = SeriesCoefficient[Series[Log[1 + x], {x, 0,
> 100}], #]x^# & /@
> Range[100];
>
> p3vals = Through[{Re, Im}[#]] & @@@ Table[
> zlist = x /. NSolve[Total[Take[s100, nval]]
> 00, nval]] == 0];
> Pick[zlist, #, Min[#]] &[Abs[zlist - p3]],
> {nval, 100}];
>
> lp3 = ListPlot[p3vals, PlotRange -> All, AspectRatio
> -> Automatic,
> Epilog -> {circleColor, Circle[{0, 0}, 1, {0,
> {0, Pi/2}], p3color,
> PointSize[.03], Point[Through[{Re, Im}[p3]]]}]
>
> Peter
>
- Follow-Ups:
- Re: Re: Searching list for closest match to p
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: Searching list for closest match to p