Mathc matrices/c101b
Installer et compiler ces fichiers dans votre répertoire de travail.
c04.c |
---|
/* ------------------------------------ */
/* Save as : c04.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double ab[R4*C7]={
+1, -3, +4, -2, +5, +4, 0,
+2, -6, +9, -1, +8, +2, 0,
+2, -6, +9, -1, +9, +7, 0,
-1, 3, -4, 2, -5, -4, 0,
};
double **Ab = ca_A_mR(ab,i_Abr_Ac_bc_mR(R4,C6,C1));
double **A = c_Ab_A_mR(Ab,i_mR(R4,C6));
double **b = c_Ab_b_mR(Ab,i_mR(R4,C1));
double **Ab_free = i_Abr_Ac_bc_mR(csize_A_R(Ab),csize_A_R(Ab),C1+C3);
/* b = C1 + C3 free variables */
clrscrn();
printf(" A :");
p_mR(A,S6,P1,C10);
printf(" b :");
p_mR(b,S6,P1,C10);
printf(" Ab :");
p_mR(Ab,S6,P1,C10);
stop();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(Ab,"Ab",P1);
printf("\n rref(Ab,.00000000001)\n\n");
printf(" Ab : gj_PP_mR(Ab,NO) :");
gj_PP_mR(Ab,NO);
p_mR(Ab,S6,P1,C10);
stop();
clrscrn();
put_zeroR_mR(Ab,Ab_free);
printf(" Ab_free : put_zeroR_mR(Ab,Ab_free); ");
p_mR(Ab_free,S6,P3,C10);
stop();
clrscrn();
put_freeV_mR(Ab_free);
printf(" Ab_free : put_freeV_mR(Ab_free); ");
p_mR(Ab_free,S6,P3,C10);
stop();
f_mR(Ab);
f_mR(b);
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
On pose les trois variables libres (1) dans la matrice A et dans la matrice b
Exemple de sortie écran :
------------------------------------
A :
+1.0 -3.0 +4.0 -2.0 +5.0 +4.0
+2.0 -6.0 +9.0 -1.0 +8.0 +2.0
+2.0 -6.0 +9.0 -1.0 +9.0 +7.0
-1.0 +3.0 -4.0 +2.0 -5.0 -4.0
b :
+0.0
+0.0
+0.0
+0.0
Ab :
+1.0 -3.0 +4.0 -2.0 +5.0 +4.0 +0.0
+2.0 -6.0 +9.0 -1.0 +8.0 +2.0 +0.0
+2.0 -6.0 +9.0 -1.0 +9.0 +7.0 +0.0
-1.0 +3.0 -4.0 +2.0 -5.0 -4.0 +0.0
Press return to continue.
Copy/Past into the octave window.
Ab=[
+1.0,-3.0,+4.0,-2.0,+5.0,+4.0,+0.0;
+2.0,-6.0,+9.0,-1.0,+8.0,+2.0,+0.0;
+2.0,-6.0,+9.0,-1.0,+9.0,+7.0,+0.0;
-1.0,+3.0,-4.0,+2.0,-5.0,-4.0,+0.0]
rref(Ab,.00000000001)
Ab : gj_PP_mR(Ab,NO) :
+1.0 -3.0 +4.5 -0.5 +4.0 +1.0 +0.0
-0.0 -0.0 +1.0 +3.0 -2.0 -6.0 -0.0
+0.0 +0.0 +0.0 +0.0 +1.0 +5.0 +0.0
+0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0
Press return to continue.
Ab_free : put_zeroR_mR(Ab,Ab_free);
+1.000 -3.000 +4.500 -0.500 +4.000 +1.000 +0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000
-0.000 -0.000 +1.000 +3.000 -2.000 -6.000 -0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000 +1.000 +5.000 +0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000 +0.000
Press return to continue.
Ab_free : put_freeV_mR(Ab_free);
+1.000 -3.000 +4.500 -0.500 +4.000 +1.000 +0.000 +0.000 +0.000 +0.000
+0.000 +1.000 +0.000 +0.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000
-0.000 -0.000 +1.000 +3.000 -2.000 -6.000 -0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +0.000 +1.000 +0.000
+0.000 +0.000 +0.000 +0.000 +1.000 +5.000 +0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000 +0.000 +1.000 +0.000 +0.000 +0.000 +1.000
Press return to continue.