Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

RE: Illumination or obfuscation?

  • To: mathgroup at
  • Subject: [mg43986] RE: [mg43943] Illumination or obfuscation?
  • From: "David Park" <djmp at>
  • Date: Thu, 16 Oct 2003 04:16:45 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


It is not meant to illuminate but to be compact and efficient. The trouble
with one-liners is that they are difficult to follow. But all you have to do
is unravel them.


px = {1, 0};
py = {0, 1};
m[th_] := {{Cos[th], Sin[th]}, {-Sin[th], Cos[th]}}

We can experiment and see what the routine does. It clearly draws two

crossPoint[{1, 1}]
{Arrow[{0.5, 1.}, {1.5, 1.}, HeadLength -> 0.015],
  Arrow[{1., 0.5}, {1., 1.5}, HeadLength -> 0.015]}

Play around with the parameters in the following plot to see what it does

      {crossPoint[pt = {1, 3}, 45°, 6],
        Red, AbsolutePointSize[5], Point[pt]}],
    AspectRatio -> Automatic,
    PlotRange -> All,
    Frame -> True];

Now we can unravel it...

p = {1, 3};
th = \[Pi]/4;
L = 6;
Print["Initial vectors"]
{px, py}
Print["Stretching them"]
Print["Forming two symmetrical points for Arrow"]
{-#, #} & /@ %%
Print["Rotating and shifting the coordinates"]
p + #.m[th] & /@ %%
Print["Inserting each row into the Arrow command"]
Arrow[##, HeadLength -> 0.015] & @@ # & /@ %%

Only the last instruction is a little difficult. It is inserting two
arguments into the Arrow primitive by apply the function to each row of the
preceding matrix.

David Park
djmp at

From: Steven T. Hatton [mailto:hattons at]
To: mathgroup at

To an experienced Mathematica user, is the following snippet clear, and easy
to understand, or simply an exercise in obfuscation? Assume I already have
px,py and m[] lying around.

px = {1, 0};
py = {0, 1};

m[th_] := {{Cos[th], Sin[th]}, {-Sin[th], Cos[th]}}

crossPoint[p_, th_:0, L_:0.5] :=
  Arrow[##,HeadLength -> 0.015]&@@#&/@(p+#.m[th]&/@{-#, #}&/@(L{px, py}))

  • Prev by Date: Re: Concentric contours about the centroid, having the same length, and interior to an initial contour.
  • Next by Date: Linux & Mathematica 4.2:NotebookDirectory is not a known option
  • Previous by thread: RE: Illumination or obfuscation?
  • Next by thread: RE: Illumination or obfuscation?