MathGroup Archive 2000

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

Search the Archive

RE: Could we build matrix with codition instruction?


> From: Coase Yang [mailto:cnc at ms6.hinet.net]
To: mathgroup at smc.vnet.net
> Dear All:
> 
> I want to construct an 4*4 upper triangular matrix with
> conditional instruction, a[i,j]:
> if j-i>=0, then a[[i,j]]=1
> if j-i<0, then a[[i,j]]=0
> Could anyone tell me how I could build this matrix with
> list or Table form by conditional instruction inside?
> 
> Thank you very much.
> 
> Coase Yang
> 

Table[If[j - i >= 0, 1, 0], {i, 1, 4}, {j, 1, 4}]

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

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


  • Prev by Date: Re: Follow-up on Do[] Question
  • Next by Date: ExitDialog in ButtonfFunction
  • Previous by thread: Re: Could we build matrix with codition instruction?
  • Next by thread: Re: Could we build matrix with codition instruction?