MathGroup Archive 2005

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

Search the Archive

Re: Strange Elements in Table

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60464] Re: Strange Elements in Table
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 17 Sep 2005 02:31:46 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <dgdu8l$15f$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

kristoph wrote:
> I use a couple IF's which specify the elements in a 2x10 table. When I
> look at the table after calculation, I get a 2x11 table. Why??? All the
> needed results are in the first 10 columns, the 11th states the If
> commands. 
> Any idea how to get rid of the last column?  Thanks for help
> 
It is difficult to pinpoint your mistake without the actual code; 
however, I hope that the following line will help you to understand how 
to fix the weird result you got.

Say we want all the entries of a 2x10 matrix being equal to the product 
of their indices except when the indices are equal:

In[1]:=
Table[If[i == j, 0, i*j], {i, 1, 2}, {j, 1, 10}]

Out[1]=
{{0, 2, 3, 4, 5, 6, 7, 8, 9, 10},
   {2, 0, 6, 8, 10, 12, 14, 16, 18, 20}}

Hope this helps,
/J.M.


  • Prev by Date: Re: Mathematica: access serial port?
  • Next by Date: Re: number of digits in n^p
  • Previous by thread: Re: Strange Elements in Table
  • Next by thread: Re: Strange Elements in Table