Mathc matrices/c30b
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c1b.c |
---|
/* ------------------------------------ */
/* Save as : c1b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double a[R4*C5]={
1, 3, 2, 3, 0,
9, 1, 1, 2, 3,
2, 3, 8, 5, -2,
3, 4, 8, 1, 1,
};
double **A = ca_A_mR(a,i_mR(R4,C5));
int i = 1;
/* 1-----------------------------------
+1.000 +3.000 +2.000 +3.000 +0.000
+9.000 +1.000 +1.000 +2.000 +3.000
+2.000 +3.000 +8.000 +5.000 -2.000
+3.000 +4.000 +8.000 +1.000 +1.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R2 = -9*R1 + R2 \n");addR_mR(A, -9,R1,R2);
printf(" R3 = -2*R1 + R3 \n");addR_mR(A, -2,R1,R3);
printf(" R4 = -3*R1 + R4 \n");addR_mR(A, -3,R1,R4);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+1.000 +3.000 +2.000 +3.000 +0.000
+0.000 -26.000 -17.000 -25.000 +3.000
+0.000 -3.000 +4.000 -1.000 -2.000
+0.000 -5.000 +2.000 -8.000 +1.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R3 = -26*R3 \n"); mulR_mR(A,-26.,R3);
printf(" R4 = -26*R4 \n"); mulR_mR(A,-26.,R4);
printf(" R3 = 3*R2 + R3 \n");addR_mR(A, 3.,R2,R3);
printf(" R4 = 5*R2 + R4 \n");addR_mR(A, 5.,R2,R4);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+1.000 +3.000 +2.000 +3.000 +0.000
+0.000 -26.000 -17.000 -25.000 +3.000
+0.000 +0.000 -155.000 -49.000 +61.000
+0.000 +0.000 -137.000 +83.000 -11.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R4 = -155*R4 \n"); mulR_mR(A,-155.,R4);
printf(" R4 = 137*R3 + R4 \n");addR_mR(A, 137.,R3,R4);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+1.000 +3.000 +2.000 +3.000 +0.000
+0.000 -26.000 -17.000 -25.000 +3.000
+0.000 +0.000 -155.000 -49.000 +61.000
+0.000 +0.000 +0.000 -19578.000 +10062.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R4 = -1./78.*R4 \n");mulR_mR(A,-1./78.,R4);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+1.000 +3.000 +2.000 +3.000 +0.000
+0.000 -26.000 -17.000 -25.000 +3.000
+0.000 +0.000 -155.000 -49.000 +61.000
+0.000 +0.000 +0.000 +251.000 -129.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R1 = 251.*R1 \n"); mulR_mR(A,251.,R1);
printf(" R2 = 251.*R2 \n"); mulR_mR(A,251.,R2);
printf(" R3 = 251.*R3 \n"); mulR_mR(A,251.,R3);
printf(" R1 = -3*R4 + R1 \n");addR_mR(A, -3.,R4,R1);
printf(" R2 = 25*R4 + R2 \n");addR_mR(A, 25.,R4,R2);
printf(" R3 = 49*R4 + R3 \n");addR_mR(A, 49.,R4,R3);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+251.000 +753.000 +502.000 +0.000 +387.000
+0.000 -6526.000 -4267.000 +0.000 -2472.000
+0.000 +0.000 -38905.000 +0.000 +8990.000
+0.000 +0.000 +0.000 +251.000 -129.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R3 = -1./155.*R3 \n");mulR_mR(A,-1./155.,R3);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+251.000 +753.000 +502.000 +0.000 +387.000
+0.000 -6526.000 -4267.000 +0.000 -2472.000
+0.000 +0.000 +251.000 +0.000 -58.000
+0.000 +0.000 +0.000 +251.000 -129.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R1 = -2*R3 + R1 ( 2*251 = 502)\n");addR_mR(A, -2.,R3,R1);
printf(" R2 = +17*R3 + R2 (17*251 = 4267)\n");addR_mR(A,+17.,R3,R2);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+251.000 +753.000 +0.000 +0.000 +503.000
+0.000 -6526.000 +0.000 +0.000 -3458.000
+0.000 +0.000 +251.000 +0.000 -58.000
+0.000 +0.000 +0.000 +251.000 -129.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R2 = -1./26.*R2 \n");mulR_mR(A,-1./26.,R2);
p_mR(A,S10,P1,C6);
getchar();
/* 1-----------------------------------
+251.000 +753.000 +0.000 +0.000 +503.000
+0.000 +251.000 +0.000 +0.000 +133.000
+0.000 +0.000 +251.000 +0.000 -58.000
+0.000 +0.000 +0.000 +251.000 -129.000
------------------------------------ */
clrscrn();
printf(" (%d) \n\n",i++);
p_mR(A,S10,P1,C6);
printf(" R1 =-3*R2 + R1 (3*251 = 753) \n");addR_mR(A,-3.,R2,R1);
p_mR(A,S10,P1,C6);
getchar();
f_mR(A);
getchar();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
------------------------------------
(1)
+1.0 +3.0 +2.0 +3.0 +0.0
+9.0 +1.0 +1.0 +2.0 +3.0
+2.0 +3.0 +8.0 +5.0 -2.0
+3.0 +4.0 +8.0 +1.0 +1.0
R2 = -9*R1 + R2
R3 = -2*R1 + R3
R4 = -3*R1 + R4
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 -3.0 +4.0 -1.0 -2.0
+0.0 -5.0 +2.0 -8.0 +1.0
------------------------------------
(2)
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 -3.0 +4.0 -1.0 -2.0
+0.0 -5.0 +2.0 -8.0 +1.0
R3 = -26*R3
R4 = -26*R4
R3 = 3*R2 + R3
R4 = 5*R2 + R4
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 +0.0 -155.0 -49.0 +61.0
+0.0 +0.0 -137.0 +83.0 -11.0
------------------------------------
(3)
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 +0.0 -155.0 -49.0 +61.0
+0.0 +0.0 -137.0 +83.0 -11.0
R4 = -155*R4
R4 = 137*R3 + R4
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 +0.0 -155.0 -49.0 +61.0
+0.0 +0.0 +0.0 -19578.0 +10062.0
------------------------------------
(4)
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 +0.0 -155.0 -49.0 +61.0
+0.0 +0.0 +0.0 -19578.0 +10062.0
R4 = -1./78.*R4
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 +0.0 -155.0 -49.0 +61.0
-0.0 -0.0 -0.0 +251.0 -129.0
------------------------------------
(5)
+1.0 +3.0 +2.0 +3.0 +0.0
+0.0 -26.0 -17.0 -25.0 +3.0
+0.0 +0.0 -155.0 -49.0 +61.0
-0.0 -0.0 -0.0 +251.0 -129.0
R1 = 251.*R1
R2 = 251.*R2
R3 = 251.*R3
R1 = -3*R4 + R1
R2 = 25*R4 + R2
R3 = 49*R4 + R3
+251.0 +753.0 +502.0 +0.0 +387.0
+0.0 -6526.0 -4267.0 +0.0 -2472.0
+0.0 +0.0 -38905.0 +0.0 +8990.0
-0.0 -0.0 -0.0 +251.0 -129.0
------------------------------------
(6)
+251.0 +753.0 +502.0 +0.0 +387.0
+0.0 -6526.0 -4267.0 +0.0 -2472.0
+0.0 +0.0 -38905.0 +0.0 +8990.0
-0.0 -0.0 -0.0 +251.0 -129.0
R3 = -1./155.*R3
+251.0 +753.0 +502.0 +0.0 +387.0
+0.0 -6526.0 -4267.0 +0.0 -2472.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0
------------------------------------
(7)
+251.0 +753.0 +502.0 +0.0 +387.0
+0.0 -6526.0 -4267.0 +0.0 -2472.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0
R1 = -2*R3 + R1 ( 2*251 = 502)
R2 = +17*R3 + R2 (17*251 = 4267)
+251.0 +753.0 +0.0 +0.0 +503.0
+0.0 -6526.0 +0.0 +0.0 -3458.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0
------------------------------------
(8)
+251.0 +753.0 +0.0 +0.0 +503.0
+0.0 -6526.0 +0.0 +0.0 -3458.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0
R2 = -1./26.*R2
+251.0 +753.0 +0.0 +0.0 +503.0
-0.0 +251.0 -0.0 -0.0 +133.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0
------------------------------------
(9)
+251.0 +753.0 +0.0 +0.0 +503.0
-0.0 +251.0 -0.0 -0.0 +133.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0
R1 =-3*R2 + R1 (3*251 = 753)
+251.0 +0.0 +0.0 +0.0 +104.0
-0.0 +251.0 -0.0 -0.0 +133.0
-0.0 -0.0 +251.0 -0.0 -58.0
-0.0 -0.0 -0.0 +251.0 -129.0