Mathc matrices/c15c
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = i_mR(r,r);
double **b = i_mR(r,r);
double **Ab = i_Abr_Ac_bc_mR( r, r, r);
/* i_Abr_Ac_bc_mR(R_Ab,C_A,C_b)); */
double **invA = i_mR(r,r);
do
{
r_mR(A,999.);
printf(".");
}while(!det_R(A));
clrscrn();
printf(" A :");
p_mR(A,S8,P0,C4);
printf(" b : ID :");
eye_mR(b);
p_mR(b,S8,P0,C4);
stop();
clrscrn();
printf(" Ab :");
c_A_b_Ab_mR(A,b,Ab);
p_mR(Ab,S8,P0,C4);
printf(" gj_TP_mR(Ab) :");
gj_TP_mR(Ab);
pE_mR(Ab,S14,P4,C4);
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,S14,P4,C4);
f_mR(invA);
f_mR(Ab);
f_mR(b);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R4);
} while(stop_w());
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