Mathc matrices/c17d
Aller à la navigation
Aller à la recherche
Installer et compiler ces fichiers dans votre répertoire de travail.
![]() |
gj_r4.c |
---|
/* ------------------------------------ */
/* Save as : gj_r4.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **xx_GJ_TPfreeV_mR(
double **Ab,
double **new_Ab)
{
int r;
c_mR(Ab,new_Ab);
put_freevariable_mR(new_Ab,Ab[R_SIZE][C0]);
printf(" ---------------DEBUG ------------- \n");
clrscrn();
printf(" Copy/Past into the octave window.\n\n");
p_Octave_mR(new_Ab,"new_Ab",P8);
printf("\n rref(new_Ab,.00000000001)\n\n");
stop();
clrscrn();
printf(" ---------------DEBUG ------------- \n");
r = rsize_R(new_Ab);
while(r>R1)
zero_below_pivot_gj1Ab_mR(new_Ab,r--);
return(new_Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
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);
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,P5,C7);
stop();
clrscrn();
xx_GJ_TPfreeV_mR(Ab,new_Ab);
printf(" new_Ab :");
p_mR(new_Ab,S10,P5,C7);
f_mR(new_Ab);
f_mR(Ab);
f_mR(b);
f_mR(A);
}
/* ------------------------------------ */
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); pour résoudre ce système.
Exemple de sortie écran :
A :
-511 -275 +892 +390 -133 -435
+876 -605 -953 -657 +570 +94
+698 -999 +64 +630 -775 +980
-371 -479 +144 -387 -823 -469
b :
-431
+806
-767
-877
Ab :
-511 -275 +892 +390 -133 -435 -431
+876 -605 -953 -657 +570 +94 +806
+698 -999 +64 +630 -775 +980 -767
-371 -479 +144 -387 -823 -469 -877
Press return to continue.
Ab :
+1.00000 +0.00000 +0.00000 +0.00000 +4.89548 -1.07928 +4.63173
+0.00000 +1.00000 +0.00000 +0.00000 +2.27117 -0.54716 +2.19847
+0.00000 +0.00000 +1.00000 +0.00000 +4.90823 -2.19576 +4.29028
+0.00000 +0.00000 +0.00000 +1.00000 -3.55123 +2.10675 -3.29881
Press return to continue.
---------------DEBUG -------------
Copy/Past into the octave window.
new_Ab=[
+1.00000000,+0.00000000,+0.00000000,+0.00000000,+4.89547912,-1.07928270,+4.63172781,+0.00000000,+0.00000000;
+0.00000000,+1.00000000,+0.00000000,+0.00000000,+2.27116661,-0.54715956,+2.19847244,+0.00000000,+0.00000000;
+0.00000000,+0.00000000,+1.00000000,+0.00000000,+4.90822963,-2.19575860,+4.29027855,+0.00000000,+0.00000000;
+0.00000000,+0.00000000,+0.00000000,+1.00000000,-3.55123124,+2.10675471,-3.29880932,+0.00000000,+0.00000000;
+0.00000000,+0.00000000,+0.00000000,+0.00000000,+1.00000000,+0.00000000,+0.00000000,+1.00000000,+0.00000000;
+0.00000000,+0.00000000,+0.00000000,+0.00000000,+0.00000000,+1.00000000,+0.00000000,+0.00000000,+1.00000000]
rref(new_Ab,.00000000001)
---------------DEBUG -------------
Press return to continue.
new_Ab :
+1.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +4.63173
+0.00000 +1.00000 +0.00000 +0.00000 +0.00000 +0.00000 +2.19847
+0.00000 +0.00000 +1.00000 +0.00000 +0.00000 +0.00000 +4.29028
+0.00000 +0.00000 +0.00000 +1.00000 +0.00000 +0.00000 -3.29881
+0.00000 +0.00000 +0.00000 +0.00000 +1.00000 +0.00000 +0.00000
+0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +1.00000 +0.00000
-4.89548 +1.07928
-2.27117 +0.54716
-4.90823 +2.19576
+3.55123 -2.10675
+1.00000 +0.00000
+0.00000 +1.00000
Press return to continue
Press X to stop