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: Re: Special Matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28276] Re: [mg28231] Re: Special Matrix
  • From: Mianlai Zhou <lailai at carmen.nikhef.nl>
  • Date: Sat, 7 Apr 2001 03:44:34 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Fri, 6 Apr 2001, Paul Lutus wrote:

> "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?
>
> f[n_]:= Table[Sign[Mod[x*y,n-1]],{x,0,n-1},{y,0,n-1}]
>
Hi:

This is wrong. When n is equal to 5, it will give a matrix with a 0 in the
coordinate of (3, 3), because that Mod[2*2, 5-1] == 0.

Should be corrected as:

Table[ Sign[Mod[x,n-1]*Mod[y,n-1]], {x,0,n-1}, {y,0,n-1} ]



  • Prev by Date: Accelerating remote mathematica display
  • Next by Date: Re: How to convert a list of functions in a list valued function
  • Previous by thread: Re: Special Matrix
  • Next by thread: Re: Special Matrix