Re: Re: Searching list for closest match to p
- To: mathgroup at smc.vnet.net
- Subject: [mg79460] Re: Re: Searching list for closest match to p
- From: chuck009 <dmilioto at comcast.com>
- Date: Fri, 27 Jul 2007 05:52:16 -0400 (EDT)
Looks like an error with your copy: The NSolve construct as coded by Peter reads: Table[zlist = x /. NSolve[Total[Take[s100, nval]] == 0]; At least I think that's the error you're referring to. > But there's a syntax error in that code. > > chuck009 wrote: > > 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 > >> > > > > -- > Murray Eisenberg > murray at math.umass.edu > 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 >