How to create a matrix in Mathematica online
How to create a matrix in Mathematica online
Here’s the easiest way to create a matrix in Mathematica online. I couldn’t find any templates. Start by making a matrix of all 0’s using the Table command. You can cut and paste this code into your file. Our matrices are always square, so just set the variable n to be the size of your matrix.
In[]:=
n=5;Table[0,{i,1,n},{j,1,n}]
Out[]=
{{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}}
Now cut and paste this output into an input cell. You can use carriage returns in your input cell to format your matrix input for easy reading. Be careful not to delete any of the brackets!
In[]:=
mat=1.{{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}}
Out[]=
{{0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.}}
Type your entries into the matrix, and you’re good to go!