Good day to all,(adsbygoogle = window.adsbygoogle || []).push({});

I'm trying to construct a m x m (size) matrix which have 1/2 on the diagonal, zeros to the lower triangular and 1 to the upper triangular.

m=10;

f[i_,j_]:=1/2 /i==j

f[i_,j_]:=1 /i>=j

f[i_,j_]:=0 /i<j

m=Array[f,{m,m}];

m //MatrixForm

I think, supposedly this will works but the answer came out with a matrix 'True'

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"},

{"True", "True", "True", "True", "True", "True", "True", "True",

"True", "True"}

Anybody could enlightened me, please.

thank you in advance.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica - Construct a Matrix

Loading...

Similar Threads - Mathematica Construct Matrix | Date |
---|---|

Mathematica Cannot do the integral of the Hyper-geometric function? | Mar 11, 2018 |

Mathematica Cannot Plot This Function in Mathematica | Feb 26, 2018 |

Mathematica While Loop in Mathematica | Feb 25, 2018 |

Construct matrix from vectors in Mathematica | Jun 2, 2012 |

Mathematica - Constructing Matrices | Aug 24, 2010 |

**Physics Forums - The Fusion of Science and Community**