Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Column vectors should be interpreted as simple lists where

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121335] Re: Column vectors should be interpreted as simple lists where
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 11 Sep 2011 07:28:45 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

MF[x_] := Map[Flatten, x]

When using postfix notation you don't need to use a pure function form such as MF[#]&

Graphics[{
  {Directive[Thick, Gray],
   Line[Table[{{x}, {Sin[x]}}, {x, 0, 6.3, 0.1}] // MF]},
  {Directive[Dashed, Blue],
   Line[{{{2}, {0}}, {{2}, {Sin[2]}}, {{0}, {Sin[2]}}} // MF]},
  {Directive[PointSize[0.02], Blue],
   Point[{{2}, {Sin[2]}}] // MF}},
 Axes -> True]

However, you don't need Flatten if you don't insert all of those extraneous brackets.

Graphics[{
  {Directive[Thick, Gray],
   Line[Table[{x, Sin[x]}, {x, 0, 6.3, 0.1}]]},
  {Directive[Dashed, Blue],
   Line[{{2, 0}, {2, Sin[2]}, {0, Sin[2]}}]},
  {Directive[PointSize[0.02], Blue], Point[{2, Sin[2]}]}},
 Axes -> True]

Eliminating other extraneous material

Graphics[{
  {Thick, Gray,
   Line[Table[{x, Sin[x]}, {x, 0, 6.3, 0.1}]]},
  Dashed, Blue,
  Line[{{2, 0}, {2, Sin[2]}, {0, Sin[2]}}],
  PointSize[0.02],
  Point[{2, Sin[2]}]},
 Axes -> True]


Bob Hanlon

---- "Christopher O. Young" <cy56 at comcast.net> wrote: 

=============
It's a nuisance not to be able to enter data for points in the most readable
and intuitive form, i.e., as column vectors, without having to Flatten out
each column vector.

The best workaround I could come up with was to use the following to convert
lists of points to lists of lists.

It's good that we don't need to waste space with parentheses, though. We can
just type in the column vectors as column arrays using Control-return. But
it would be even better if there were something close to the regular square
bracket notation, which is the accepted mathematical notation, and also
takes less space-consuming than curved parentheses.

If WRI could also stop insisting that all input is boldface, users could use
the excellent, time-honored, intuitive notation of having bold-face for
vectors and matrices and regular type for scalars.

Would this be so hard to implement? Maybe slightly different square brackets
could be used, accessible via holding down the option key.

It would be also be a huge time-saver if there were a way to get bracket
pairs via holding down the Control-key, say. I.e., Control-( would type a
_pair_ of parentheses, Control-[ would type a pair of square brackets, etc.

There's a picture at http://home.comcast.net/~cy56/ColumnVectors.png and a
notebook at http://home.comcast.net/~cy56/ColumnVectorsAsPoints.nb .

MF[x_] := Map[Flatten, x]

Graphics[
 {
  {Directive[Thick, Gray],
   Line[Table[{
       {x},
       {Sin[x]}
      } , {x, 0, 6.3, 0.1}] // MF[#] &]},
  
  {Directive[Dashed, Blue],
   Line[{{
       {2},
       {0}
      } , {
       {2},
       {Sin[2]}
      } , {
       {0},
       {Sin[2]}
      }} // MF[#] &]},
  
  {Directive[PointSize[0.02], Blue],
   Point[ {
      {2},
      {Sin[2]}
     } ] // MF[#] &}
  },
 Axes -> True
 ]



--

Bob Hanlon





  • Prev by Date: Re: help to make code run faster (mathematica v8.01)
  • Next by Date: Re: help to make code run faster (mathematica v8.01)
  • Previous by thread: Re: Column vectors should be interpreted as simple lists where
  • Next by thread: Re: Column vectors should be interpreted as simple lists where