Re: Special Matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg28232] Re: Special Matrix
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Fri, 6 Apr 2001 01:52:43 -0400 (EDT)
- Organization: University of Washington
- References: <9ah5nq$ps0@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Yoram,
How about
PollackMatrix[n_]:=PadLeft[Table[1,{n-2},{n-2}],{n,n},0,{1,1}]
For example
In[4]:=
PollackMatrix[7]
Out[4]=
{{0, 0, 0, 0, 0, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, 0, 0}}
Carl Woll
Physics Dept
U of Washington
"Yoram Pollack" <syftech at saad.org.il> wrote in message
news:9ah5nq$ps0 at smc.vnet.net...
> Hello
> I am trying to create a "n x n" matrix with "1" in every position exept in
> first and last row, and first and last coulumn, where "0" is needed. In
> other words: sqare matrix full of "1" sorounded by "0".
> What will be the fastest and shortest way to do it?
>
> Thanks
> Yoram
>
>
>