matrice6
(* due matrici generiche 2 x 2 *)
(* prodotto di due matrici *)
matrice1={{a11,a12},{a21,a22}}
matrice2={{b11,b12},{b21,b22}}
matrice1.matrice2
{{a11, a12}, {a21, a22}}
;[o]
{{a11, a12}, {a21, a22}}
{{b11, b12}, {b21, b22}}
;[o]
{{b11, b12}, {b21, b22}}
{{a11*b11 + a12*b21, a11*b12 + a12*b22},
{a21*b11 + a22*b21, a21*b12 + a22*b22}}
;[o]
{{a11 b11 + a12 b21, a11 b12 + a12 b22},
{a21 b11 + a22 b21, a21 b12 + a22 b22}}
matrice1 matrice2
{{a11*b11, a12*b12}, {a21*b21, a22*b22}}
;[o]
{{a11 b11, a12 b12}, {a21 b21, a22 b22}}
matrice1*matrice2
{{a11*b11, a12*b12}, {a21*b21, a22*b22}}
;[o]
{{a11 b11, a12 b12}, {a21 b21, a22 b22}}
(* prodotto matrice con vettore *)
vettore={x,y}
matrice1.vettore
{x, y}
;[o]
{x, y}
{a11*x + a12*y, a21*x + a22*y}
;[o]
{a11 x + a12 y, a21 x + a22 y}
(* matrice per costante *)
matrice1*k
{{a11*k, a12*k}, {a21*k, a22*k}}
;[o]
{{a11 k, a12 k}, {a21 k, a22 k}}
(* stampa matrice *)
MatrixForm[matrice1]
TableForm[matrice2]
MatrixForm[{{a11, a12}, {a21, a22}}]
;[o]
a11 a12
a21 a22
TableForm[{{b11, b12}, {b21, b22}}]
;[o]
b11 b12
b21 b22
(* crea matrice generica 2 per 3 *)
(* stampa tabella matrice *)
matrice3=Table[m[i,j],{i,2},{j,3}]
MatrixForm[matrice3]
TableForm[matrice3]
{{m[1, 1], m[1, 2], m[1, 3]}, {m[2, 1], m[2, 2], m[2, 3]}}
;[o]
{{m[1, 1], m[1, 2], m[1, 3]}, {m[2, 1], m[2, 2], m[2, 3]}}
MatrixForm[{{m[1, 1], m[1, 2], m[1, 3]}, {m[2, 1], m[2, 2], m[2, 3]}}]
;[o]
m[1, 1] m[1, 2] m[1, 3]
m[2, 1] m[2, 2] m[2, 3]
TableForm[{{m[1, 1], m[1, 2], m[1, 3]}, {m[2, 1], m[2, 2], m[2, 3]}}]
;[o]
m[1, 1] m[1, 2] m[1, 3]
m[2, 1] m[2, 2] m[2, 3]
(* mostra dimensione matrice o vettore *)
Dimensions[matrice3]
Dimensions[vettore]
{2, 3}
;[o]
{2, 3}
{2}
;[o]
{2}
(* crea matrice generica 2 per 3 *)
matrice4=Array[h,{2,3}]
MatrixForm[matrice4]
{{h[1, 1], h[1, 2], h[1, 3]}, {h[2, 1], h[2, 2], h[2, 3]}}
;[o]
{{h[1, 1], h[1, 2], h[1, 3]}, {h[2, 1], h[2, 2], h[2, 3]}}
MatrixForm[{{h[1, 1], h[1, 2], h[1, 3]}, {h[2, 1], h[2, 2], h[2, 3]}}]
;[o]
h[1, 1] h[1, 2] h[1, 3]
h[2, 1] h[2, 2] h[2, 3]
ritorna a inizio