Re: Postfix specification graphics, etc.
- To: mathgroup at smc.vnet.net
- Subject: [mg118472] Re: Postfix specification graphics, etc.
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 29 Apr 2011 07:31:38 -0400 (EDT)
I can find no documentation of this form of Drop: Drop[P, {}, {2}] but the expression appears to have the same effect as Drop[P, None, {2}] which is... slightly... barely... buried deep... but vaguely documented. Also note that P[[All, -1]] or P[[All, 2]] is equivalent to, simpler, and far more obvious, I think, compared to P // Drop[#, None, {1}] & // Flatten[#, 1] & Bobby On Thu, 28 Apr 2011 05:34:44 -0500, Christopher O. Young <cy56 at comcast.net> wrote: > I think I'm finally catching on to the pure function notation enough to > put > everything into the kind of postfix notation I prefer. It just seems > preferable to me to have the geometrical objects positioned first, where > they're most prominent, and have the commands that modify their display > following them. > > For example, the following plots a "trammel" sliding in a corner, always > tangent to the same hyperbola. All the lines are colored with > corresponding > colors for the points. > > > P = {{0, k}, {10 - k, 0}}~Table~{k, 0, 10}; > (* Points for the lines *) > > S = Drop[P, {}, {2}] // Flatten[#, 1] &; > (* The start points *) > > F = P // Drop[#, {}, {1}] & // Flatten[#, 1] &; > > (* The finish points *) > > ({ > Line[{S[[j]], F[[j]]}] // {Hue[0.8 (j - 1)/9],Thickness[0.02], #} &, > {Point[S[[j]]], Point[F[[j]]]} //{Hue[0.8 (j - 1)/9],PointSize[0.05],#} > & > > } > ~Table~{j, 1, 11})\ > // Graphics > > It's a little irritating to have to add parentheses to get Graphics to > have > enough scope, and a backslash to continue to the next line, but I still > like > getting the lines and points first. > > One interesting thing here is that > > {Hue[0.8 (j - 1)/9],Thickness[0.02], #} & > is being used as a pure function, i.e., the list function, so that I can > list each set of graphics directives after the objects they modify. > > Also it's lucky that I can get away with putting the points in a list and > then applying the directives via another list, since I haven't been able > to > get it to work via numbered slots (i.e., #1, #2, etc.). > > > I don't think it's accidental that the "//" form resembles the "pipe" > operator from Unix, since it seems to be possible to use it for the same > purpose, to "pipe" the output of one command into another. > > One question: How do I get all the points to plot on top? > > Chris Young > cy56 at comcast.net > IntuMath.org > > > -- DrMajorBob at yahoo.com