Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1980 > unrolled thread
| Started by | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| First post | 2011-04-29 11:31 +0000 |
| Last post | 2011-04-29 11:31 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Postfix specification graphics, etc. DrMajorBob <btreat1@austin.rr.com> - 2011-04-29 11:31 +0000
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Date | 2011-04-29 11:31 +0000 |
| Subject | Re: Postfix specification graphics, etc. |
| Message-ID | <ipe7ij$quc$1@smc.vnet.net> |
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@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@comcast.net
> IntuMath.org
>
>
>
--
DrMajorBob@yahoo.com
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web