       Re: Matrix with number of rows / columns not fixed

• To: mathgroup at smc.vnet.net
• Subject: [mg112325] Re: Matrix with number of rows / columns not fixed
• From: apjs64 <apjs64 at gmail.com>
• Date: Thu, 9 Sep 2010 04:23:52 -0400 (EDT)
• References: <i627tm\$bm\$1@smc.vnet.net>

```On Sep 6, 6:14 pm, Hayley <hayley0... at gmail.com> wrote:
> I'm new to Mathematica and would like to know if I can specify a
> matrix where the number of rows / columns is not fixed.
>
> As a simple example, how can I input a diagonal matrix with elements
> (s1, s2, ..., sL) where I don't specify what L is?
>
> I'd like to multiply together a few such matrixes and find the inverse
> of the product, and would ideally like Mathematica to give me the
> answer in terms of summations from 1 to L.
>
> Hope this sounds possible...!

I am fairly new as well and this may not be optimal. I guess you may
mean import data in which case I am sure the mathematica routines will
do the right thing for you. You need to be clear on the difference
between a list and a matrix in mathematica. Try for a start the help :
guide/ConstructingMatrices.

Clear[list, matrix, max]
max = 3
list = Table[0, {i, max}, {j, max}]
list[[1, 1]] = 1 (* etc etc *)
matrix = MatrixForm[list]

Partition, Flatten, PadRight will be of great assistance to you.

good luck and don't be discouraged, Jeremy

```

• Prev by Date: Re: How to delay action of ...[[i]] (Part[...,i])
• Next by Date: Re: Collecting Positive and Negative Terms
• Previous by thread: Re: Matrix with number of rows / columns not fixed
• Next by thread: Holding arguments of a family of functions