Mathc matrices/a258
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"
/* ------------------------------------ */
#define RA R2
#define CA C7
#define Cb C1
/* ------------------------------------ */
void fun(void)
{
double a[RA*CA]={
+381, +184, +659, -768, -313, +623, +2,
+352, +26, +346, -675, -421, -595, -364
};
double tb[RA*Cb]={
-286,
+33
};
double **A = ca_A_mR(a, i_mR(RA,CA ));
double **b = ca_A_mR(tb,i_mR(RA,C1));
double **Ab = i_Abr_Ac_bc_mR(RA,CA,Cb);
double **new_Ab = i_Abr_Ac_bc_mR(csize_A_R(Ab),
csize_A_R(Ab),
csize_R(A)-rsize_R(A) + Cb);
double **x = i_mR(rsize_R(new_Ab),csize_b_R(new_Ab));
double **Ax = i_mR(RA,csize_b_R(new_Ab));
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);
stop();
f_mR(new_Ab);
f_mR(Ab);
f_mR(b);
f_mR(A);
f_mR(x);
f_mR(Ax);
}
/* ------------------------------------ */
int main(void)
{
fun();
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, +184, +659, -768, -313, +623, +2,
+352, +26, +346, -675, -421, -595, -364
b :
-286
+33
Ab :
+381 +184 +659 -768 -313 +623 +2
+352 +26 +346 -675 -421 -595 -364
-286
+33
Press return to continue.
Ab :
+1.0000 +0.0000 +0.8481 -1.8999 -1.2636 -2.2908 -1.2218
-0.0000 +1.0000 +1.8253 -0.2399 +0.9155 +8.1293 +2.5407
+0.2462
-2.0642
Press return to continue.
new_Ab :
+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.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.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.2462 -0.8481 +1.8999 +1.2636 +2.2908 +1.2218
-2.0642 -1.8253 +0.2399 -0.9155 -8.1293 -2.5407
+0.0000 +1.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 +1.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 +1.0000
Press return to continue.
x :
+0.2462 -0.8481 +1.8999 +1.2636 +2.2908 +1.2218
-2.0642 -1.8253 +0.2399 -0.9155 -8.1293 -2.5407
+0.0000 +1.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 +1.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 +1.0000
x : free variables
x1 = +0.2462 -0.8481*r +1.8999*s +1.2636*t +2.2908*u +1.2218*v
x2 = -2.0642 -1.8253*r +0.2399*s -0.9155*t -8.1293*u -2.5407*v
x3 = +0.0000 +1.0000*r +0.0000*s +0.0000*t +0.0000*u +0.0000*v
x4 = +0.0000 +0.0000*r +1.0000*s +0.0000*t +0.0000*u +0.0000*v
x5 = +0.0000 +0.0000*r +0.0000*s +1.0000*t +0.0000*u +0.0000*v
x6 = +0.0000 +0.0000*r +0.0000*s +0.0000*t +1.0000*u +0.0000*v
x7 = +0.0000 +0.0000*r +0.0000*s +0.0000*t +0.0000*u +1.0000*v
Press return to continue.
b :
-286
+33
A * x = b :
-286.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000
+33.0000 +0.0000 +0.0000 +0.0000 +0.0000 +0.0000
Press return to continue.