Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Special Matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28240] Re: Special Matrix
  • From: Erich Mueller <emuelle1 at uiuc.edu>
  • Date: Fri, 6 Apr 2001 01:52:49 -0400 (EDT)
  • Organization: University of Illinois at Urbana-Champaign
  • References: <9ah5nq$ps0@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here is one approach, Its probably not the fastest, but is relatively
straightforward:

Mat[n_] := (V = Array[1 &, n]; V[[1]] = 0; V[[n]] = 0; Outer[Times, V, V])

Typing  

Mat[3]

returns

{{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}

Erich

On 5 Apr 2001, Yoram Pollack wrote:

> 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
> 
> 
> 
> 


  • Prev by Date: Re: Special Matrix
  • Next by Date: Re: Re: Automatic expansion of Log[a^n] for a,n explicit positive integers?
  • Previous by thread: Re: Special Matrix
  • Next by thread: Re: Special Matrix