Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: Could we build matrix with codition instruction?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23331] Re: [mg23314] Could we build matrix with codition instruction?
  • From: "Mark Harder" <harderm at ucs.orst.edu>
  • Date: Tue, 2 May 2000 00:43:13 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Coase,    Copy this and try it.
In[5]:=
Needs["LinearAlgebra`MatrixManipulation`"]
In[12]:=
M = UpperDiagonalMatrix[Function[x, 1], 4];
M // MatrixForm

Out[13]//MatrixForm=
\!\(\*
  TagBox[
    RowBox[{"(", "\[NoBreak]", GridBox[{
          {"1", "1", "1", "1"},
          {"0", "1", "1", "1"},
          {"0", "0", "1", "1"},
          {"0", "0", "0", "1"}
          }], "\[NoBreak]", ")"}],
    (MatrixForm[ #]&)]\)

Look up the documentation for UpperDiagonalMatrix[] and you will see that
the first argument is a function, and it need not be just a constant,
allowing for variable UDM s.
-mark

-----Original Message-----
From: Coase Yang <cnc at ms6.hinet.net>
To: mathgroup at smc.vnet.net
Subject: [mg23331] [mg23314] Could we build matrix with codition instruction?


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



  • Prev by Date: Re: Re: Fit with constraints?
  • Next by Date: Re: Re: Fit with constraints?
  • Previous by thread: RE: Could we build matrix with codition instruction?
  • Next by thread: Re: Could we build matrix with codition instruction?