MathGroup Archive 2000

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

Search the Archive

Re: Q: Matrix Construction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26309] Re: [mg26299] Q: Matrix Construction
  • From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
  • Date: Sun, 10 Dec 2000 21:37:55 -0500 (EST)
  • References: <200012100520.AAA06993@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Christoph:

I assume you want x to be a function that returns a list of length 2 or
more for each of the inputs 1 and 2.  If you assume that this will
happen, the following pure function will work for you.

Ken Levasseur
UMass Lowell
http://faculty.uml.edu/klevasseur/courses/m419/m419.html

In[6]:=
g = {{#[1][[1]], #[1][[2]]}, {#[2][[1]], #[2][[2]]}} &

Out[6]=
{{#1[1]\[LeftDoubleBracket]1\[RightDoubleBracket], #1[
          1]\[LeftDoubleBracket]2\[RightDoubleBracket]}, {#1[
          2]\[LeftDoubleBracket]1\[RightDoubleBracket], #1[
          2]\[LeftDoubleBracket]2\[RightDoubleBracket]}} &

In[7]:=
f[k_] := Table[i^k, {i, 1, 5}]

In[8]:=
f[1]

Out[8]=
{1, 2, 3, 4, 5}

In[9]:=
f[2]

Out[9]=
{1, 4, 9, 16, 25}

In[10]:=
g[f]

Out[10]=
{{1, 2}, {1, 4}}



Christoph wrote:

>    hi,
>
> i would like to create a matrix like this
>
> {{x[1][[1]],x[1][[2]]},{x[2][[1]],x[2][[2]]}}
>
> i tried to do it like this
>
> Table[x[i][[j]],{i,2},{j,2}] and got some errormessages (partlength).
> How can i just create this table without evaluating it now. Later i
> will define some vectors x to be filled in.
>
> Greetngs
>         Christoph



  • Prev by Date: Jordan Form
  • Next by Date: General linear functions
  • Previous by thread: Q: Matrix Construction
  • Next by thread: RE: Q: Matrix Construction