Re: Scalars Instead of Lists with One Element

• To: mathgroup at smc.vnet.net
• Subject: [mg83526] Re: Scalars Instead of Lists with One Element
• From: Gregory Lypny <gregory.lypny at videotron.ca>
• Date: Thu, 22 Nov 2007 04:46:30 -0500 (EST)
• References: <fhu75c\$72j\$1@smc.vnet.net> <4742F294.5050606@gmail.com>

```Thanks everyone for your insights,

I've found the problem.  Say you want to sum a list whose elements are
13 and 9.  Mathematica will return a list with one element, {22},
rather than 22 if the original list is specified as a 2x1 column vector.

x = {{13}, {9}}; y = Total@x    >>> returns {22}

This also happens if you write x as I have above, or you use
Mathematica's Insert menu to create a more visually appealing column
vector, but it does not happen if you define x as a 2x1 array using
the Array command.

I think it will happen with any matrix calculation whose result should
otherwise be a scalar.  If we now let y be the row vector {1, 1} then

y.x    >>> returns {22}

The upshot of this is that any table that is created from calculations
that make use of column vectors or matrix math will likely have a
depth greater than 3, and you won't be able to cut and paste directly
into a word processor or spreadsheet.

I'm going to have a look at some of the work-arounds that have been
suggested in this thread and my related thread "Copy and Pasting
Tables into Spreadsheet".

Gregory

```

• Prev by Date: Re: Matching string in Mathematica
• Next by Date: Re: Re: Fast way of checking for perfect squares?
• Previous by thread: Re: Scalars Instead of Lists with One Element
• Next by thread: Re: Scalars Instead of Lists with One Element