Mathc matrices/a261
Sommaire ◀ Utilise la commande "Retour en Arrière" de ton navigateur.
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, int c)
{
double **A = i_mR(r,c);
double **b = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r,c,C1);
double **new_Ab = i_Abr_Ac_bc_mR(csize_A_R(Ab),
csize_A_R(Ab),
csize_R(A)-rsize_R(A) + C1);
double **x = i_mR(rsize_R(new_Ab),csize_b_R(new_Ab));
double **Ax = i_mR(r,csize_b_R(new_Ab));
r_mR(A,999.);
r_mR(b,999.);
clrscrn();
printf(" A :");
p_mR(A,S8,P0,C7);
printf(" b :");
p_mR(b,S8,P0,C7);
printf(" Ab :");
c_A_b_Ab_mR(A,b,Ab);
p_mR(Ab,S8,P0,C7);
stop();
clrscrn();
GJ_TP_mR(Ab);
printf(" Ab :");
p_mR(Ab,S10,P4,C7);
stop();
clrscrn();
GJ_TPfreeV_mR(Ab,new_Ab);
printf(" new_Ab :");
p_mR(new_Ab,S10,P4,C7);
stop();
clrscrn();
c_Ab_b_mR(new_Ab,x);
printf(" x :");
p_mR(x,S10,P4,C7);
printf(" x : free variables");
p_freeV(x,S8,P4);
stop();
clrscrn();
printf(" b :");
p_mR(b,S8,P0,C7);
printf(" A * x = b :");
mul_mR(A,x,Ax);
p_mR(Ax,S10,P4,C7);
f_mR(new_Ab);
f_mR(Ab);
f_mR(b);
f_mR(A);
f_mR(x);
f_mR(Ax);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R1, rp_I(R3)+R4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous utilisons la fonction GJ_TP_mR(Ab); et GJ_TPfreeV_mR(); pour résoudre ce système.
Exemple de sortie écran :
A :
+381 -806 -402 -199 +391 +434
-386 -848 +618 +73 -731 -410
+360 +120 +112 +369 +998 +786
b :
+941
-411
-113
Ab :
+381 -806 -402 -199 +391 +434 +941
-386 -848 +618 +73 -731 -410 -411
+360 +120 +112 +369 +998 +786 -113
Press return to continue.
Ab :
+1.0000 +0.0000 +0.0000 +0.7130 +2.4410 +1.9600 +0.2133
-0.0000 +1.0000 +0.0000 +0.1798 +0.2958 +0.0643 -0.4758
-0.0000 +0.0000 +1.0000 +0.8102 +0.7477 +0.6490 -1.1847
Press return to continue.
new_Ab :
+1.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.2133
-0.0000 +1.0000 +0.0000 +0.0000 +0.0000 +0.0000 -0.4758
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -1.1847
+0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000 +0.0000
+0.0000 +0.0000 +0.0000 +0.0000 +0.0000 +1.0000 +0.0000
-0.7130 -2.4410 -1.9600
-0.1798 -0.2958 -0.0643
-0.8102 -0.7477 -0.6490
+1.0000 +0.0000 +0.0000
+0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +1.0000
Press return to continue.
x :
+0.2133 -0.7130 -2.4410 -1.9600
-0.4758 -0.1798 -0.2958 -0.0643
-1.1847 -0.8102 -0.7477 -0.6490
+0.0000 +1.0000 +0.0000 +0.0000
+0.0000 +0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +0.0000 +1.0000
x : free variables
x1 = +0.2133 -0.7130*s -2.4410*t -1.9600*u
x2 = -0.4758 -0.1798*s -0.2958*t -0.0643*u
x3 = -1.1847 -0.8102*s -0.7477*t -0.6490*u
x4 = +0.0000 +1.0000*s +0.0000*t +0.0000*u
x5 = +0.0000 +0.0000*s +1.0000*t +0.0000*u
x6 = +0.0000 +0.0000*s +0.0000*t +1.0000*u
Press return to continue.
b :
+941
-411
-113
A * x = b :
+941.0000 -0.0000 -0.0000 -0.0000
-411.0000 -0.0000 +0.0000 +0.0000
-113.0000 +0.0000 +0.0000 +0.0000
Press return to continue
Press X return to stop