% 行列とベクトル

fprintf("行列\n");
A = [  4, -2,  1; ...
      -2,  5,  2; ...
      -2,  3,  2 ];
A

fprintf("行ベクトル\n");
y = [ 2, 3, -1 ];
y

fprintf("列ベクトル\n");
x = [ 2; 3; -1 ];
x

fprintf("p = Ax\n");
p = A*x;
p

fprintf("q = yA\n");
q = y*A;
q

fprintf("3行目を5倍する\n");
A = [  4, -2,  1; ...
      -2,  5,  2; ...
      -2,  3,  2 ];
A
A(3,:) = 5*A(3,:);
A

fprintf("1行目に2行目の4倍を加える\n");
A = [  4, -2,  1; ...
      -2,  5,  2; ...
      -2,  3,  2 ];
A
A(1,:) = A(1,:) + 4*A(2,:);
A

fprintf("1行目と3行目を交換する\n");
A = [  4, -2,  1; ...
      -2,  5,  2; ...
      -2,  3,  2 ];
A
A([3,1],:) = A([1,3],:);
A
