Re: Constructing vector using table
- To: mathgroup at smc.vnet.net
- Subject: [mg90980] Re: [mg90953] Constructing vector using table
- From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
- Date: Fri, 1 Aug 2008 03:01:54 -0400 (EDT)
- References: <200807311003.GAA11246@smc.vnet.net>
Hi Prateek,
On Thu, 31 Jul 2008, Prateek K Jha wrote:
> I am trying to create a vector using "Table" in which I enter a
> function that depends on other functions. An excerpt from the code is:
>
> u2[i_] := 1 + Log[\[CapitalPhi][[i]]];
> un[i_] :=
> Switch[IntegerPart[i/(m + 1)], 0, u1n[i], 1, u2[i], 2, u2[i]];
>
> U = Table[un[i], {i, 1, 3*m}] // MatrixForm;
> Dimensions[U]
>
> Output:
> {1}
>
> Everything runs fine and even the vector is generated when I see the
> form of U. But, I am not able to do any operations on this matrix
> (like inverse, transpose etc). Even the Dimensions[U] give me 1 while
> it should be 60.
>
> Please help me through if you can. If I am not clear or you need more
> info, please let me know
>
> Regards
> Jha
>
m = 20;
\[CapitalPhi] = Range[3*m];
u2[i_] := 1 + Log[\[CapitalPhi][[i]]];
u1n[i_] := 1;
un[i_] :=
Switch[IntegerPart[i/(m + 1)], 0, u1n[i], 1, u2[i], 2, u2[i]];
u = Table[un[i], {i, 1, 3*m}];
Dimensions[u]
Dimensions[ Transpose[{u}] ]
I have added the u1n, which you use in the Table command.
Hth,
Oliver