You are on page 1of 6

Practical : 10

Name : Abhay Chauhan

Sec : A

Roll No. : 21/6244


Q.
In[2]:= A = {{a, b}, {c, d}} // MatrixForm

a b
c d

MatrixForm[{{a, b}, {c, d}}]


Out[3]= {{a, b}, {c, d}}
Out[4]//MatrixForm=

a b
c d

Q.
In[7]:= A = Table[Subscript[a, i, j], {i, 1, 3}, {j, 1, 3}] // MatrixForm
Out[7]//MatrixForm=
a1,1 a1,2 a1,3
a2,1 a2,2 a2,3
a3,1 a3,2 a3,3

Q. a(ij) = 3i+2j
In[14]:= A = Table[3 i + 2 j, {i, 1, 3}, {j, 1, 3}] // MatrixForm
2

5 7 9
8 10 12
11 13 15

Q. a(ij) = 1/2i+j
In[15]:= A = Table[1 / (2 i + j), {i, 1, 5}, {j, 1, 3}] // MatrixForm
Out[15]//MatrixForm=
1 1 1
3 4 5
1 1 1
5 6 7
1 1 1
7 8 9
1 1 1
9 10 11
1 1 1
11 12 13

Q. Print the Matrix


In[16]:= A = Table[9 i + 8 / j, {i, 1, 3}, {j, 1, 4}] // MatrixForm

Out[16]//MatrixForm=
35
17 13 3
11
62
26 22 3
20
89
35 31 3
29

In[21]:= A = MatrixPlot[Table[9 i + 8 / j, {i, 1, 3}, {j, 1, 4}]] // MatrixForm

Out[21]//MatrixForm=
1 2 3 4

1 1

2 2

3 3

1 2 3 4
3

In[25]:= MatrixPlot[{{9, 5, 3}, {0, 5, 6}, {3, 8, 9}}]


1 2 3

1 1

Out[25]= 2 2

3 3

1 2 3

In[29]:= IdentityMatrix[{3, 4}] // MatrixForm


Out[29]//MatrixForm=
1 0 0 0
0 1 0 0
0 0 1 0

In[28]:= DiagonalMatrix[{3, 4, 5}] // MatrixForm


Out[28]//MatrixForm=
3 0 0
0 4 0
0 0 5

In[31]:= DiagonalMatrix[{3, 4, 79}] // MatrixForm


Out[31]//MatrixForm=
3 0 0
0 4 0
0 0 79
4

Q. Operations on Matrices
In[142]:=

A = Table[10 i + 6 j, {i, 5}, {j, 4}]


MatrixForm[A]
B = Table[i ^ 2 + j ^ 3, {i, 5}, {j, 4}]
MatrixForm[B]
MatrixForm[A + B]
Out[142]=

{{16, 22, 28, 34}, {26, 32, 38, 44}, {36, 42, 48, 54}, {46, 52, 58, 64}, {56, 62, 68, 74}}
Out[143]//MatrixForm=
16 22 28 34
26 32 38 44
36 42 48 54
46 52 58 64
56 62 68 74
Out[144]=

{{2, 9, 28, 65}, {5, 12, 31, 68}, {10, 17, 36, 73}, {17, 24, 43, 80}, {26, 33, 52, 89}}
Out[145]//MatrixForm=
2 9 28 65
5 12 31 68
10 17 36 73
17 24 43 80
26 33 52 89
Out[146]//MatrixForm=
18 31 56 99
31 44 69 112
46 59 84 127
63 76 101 144
82 95 120 163

In[118]:= {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}, {41, 42, 43, 44}}
Out[118]=

{{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}, {41, 42, 43, 44}}

In[114]:= Dot[A * B] // MatrixForm


Out[114]//MatrixForm=
22 60 130 238
105 176 299 480
310 416 594 850
697 840 1075 1408

In[148]:=
5

In[187]:= A = Table[1 / (i + j - 1), {i, 4}, {j, 4}];


MatrixForm[A]
MatrixForm[Inverse[A]]
Out[188]//MatrixForm=
1 1 1
1 2 3 4
1 1 1 1
2 3 4 5
1 1 1 1
3 4 5 6
1 1 1 1
4 5 6 7

Out[189]//MatrixForm=
16 240 - 120
- 140
- 120 1200 - 2700 1680
240 - 2700 6480 - 4200
- 140 1680 - 4200 2800

In[12]:= A = Table[i + 2 j, {i, 5}, {j, 5}];


MatrixForm[A]
Det[A]
Transpose[A] // MatrixForm
Out[13]//MatrixForm=

3 5 7 9 11
4 6 8 10 12
5 7 9 11 13
6 8 10 12 14
7 9 11 13 15

Out[14]= 0
Out[15]//MatrixForm=
3 4 5 6 7
5 6 7 8 9
7 8 9 10 11
9 10 11 12 13
11 12 13 14 15

Out[3]= Transpose[A]

Out[169]=

0
6

You might also like