Some one could help me with this command it would be much appreciated. Use the Table command to enter a matrix with the integers 1 through 10 on the diagnol, 0 below the diagnol, and 1 above the diagnol
Yes, you are exactly right. Interestingly enough, the If statement can have a 4th argument. One can use this in the case where the test (the first argument) does not evaluate to either True or False. But if the first argument is always guaranteed to have a True or False value then the use of the 4th argument is not needed as is the case for the example here.
The lists at the end of the Table are called iterators. They have a variable and then two values that specify where the variable starts and where it ends when the increment is 1. There is another version with 4 items in the list where the 4th item is the increment when one wants it to be something other than 1.
Yeah Im just trying to make sense of the commands. I know the if command takes three arguments and gives a true or false to be evaluated. So if the command j>1 is false it would result in a 0 and a 1? And i and j also go from integers 1-10 correct?
Mathematica has really great documentation! Each of those commands is covered very well in the documentation along with detailed examples of usage. I am not trying to blow off your question, but that is probably the best resource for you.
I am new to mathematica can you explain what each command after the f statement means thanks
Table[Which[i == j, i, j > i, 1, True, 0], {i, 1, 4}, {j, 1, 4}] // MatrixForm
This:
Table[If[j == i, j, If[j > i, 1, 0]], {i, 1, 10}, {j, 1, 10}] // MatrixForm
Gives this: