Mathc matrices/a109
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R3
#define CA C3
#define Cb C3
/* ------------------------------------ */
int main(void)
{
double at[RA*CA]={
+10, -150, -148,
+207, -215, +997,
-858, +803, +289
};
double **A = ca_A_mR(at,i_mR(RA,CA));
double **b = eye_mR( i_mR(RA,Cb));
double **Ab = i_Abr_Ac_bc_mR(RA,CA,Cb);
double **invA = i_mR(RA,CA);
clrscrn();
printf(" A :");
p_mR(A,S8,P0,C6);
printf(" b : ID :");
p_mR(b,S8,P0,C6);
stop();
clrscrn();
printf(" Ab :");
c_A_b_Ab_mR(A,b,Ab);
p_mR(Ab,S8,P0,C6);
printf(" gj_TP_mR(Ab) :");
gj_TP_mR(Ab);
pE_mR(Ab,S12,P4,C6);;
stop();
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(A,"A",P0);
printf("format short e\n");
printf(" inv(A)\n\n");
printf(" invA : c_Inv_A_mR(Ab,invA);");
c_Inv_A_mR(Ab,invA);
pE_mR(invA,S12,P4,C6);
stop();
f_mR(invA);
f_mR(Ab);
f_mR(b);
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Utiliser la fonction gj_TP_mR(Ab); pour inverser une matrice.
Exemple de sortie écran :
------------------------------------
A :
-828 +6 +321 +504
+555 +300 +507 -830
+303 +959 +719 -612
-458 -594 -64 -25
b : ID :
+1 +0 +0 +0
+0 +1 +0 +0
+0 +0 +1 +0
+0 +0 +0 +1
Press return to continue.
------------------------------------
Ab :
-828 +6 +321 +504
+555 +300 +507 -830
+303 +959 +719 -612
-458 -594 -64 -25
+1 +0 +0 +0
+0 +1 +0 +0
+0 +0 +1 +0
+0 +0 +0 +1
gj_TP_mR(Ab) :
+1.0000e+00 +0.0000e+00 +0.0000e+00 +0.0000e+00
+0.0000e+00 +1.0000e+00 +0.0000e+00 +0.0000e+00
+0.0000e+00 +0.0000e+00 +1.0000e+00 +0.0000e+00
+0.0000e+00 +0.0000e+00 +0.0000e+00 +1.0000e+00
+9.6778e-04 +2.4025e-03 -2.3558e-03 -2.5803e-03
-1.1140e-03 -2.3055e-03 +2.1822e-03 +6.6390e-04
+2.6791e-03 +3.5312e-03 -2.4923e-03 -2.2132e-03
+1.8810e-03 +1.7253e-03 -2.3089e-03 -2.8374e-03
Press return to continue.
------------------------------------
Copy/Past into the octave window.
A=[
-828,+6,+321,+504;
+555,+300,+507,-830;
+303,+959,+719,-612;
-458,-594,-64,-25]
format short e
inv(A)
invA : c_Inv_A_mR(Ab,invA);
+9.6778e-04 +2.4025e-03 -2.3558e-03 -2.5803e-03
-1.1140e-03 -2.3055e-03 +2.1822e-03 +6.6390e-04
+2.6791e-03 +3.5312e-03 -2.4923e-03 -2.2132e-03
+1.8810e-03 +1.7253e-03 -2.3089e-03 -2.8374e-03
Press return to continue
Press X return to stop