Mathc complexes/a31
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : det_z_a.c */
void fun(int r)
double **A = r_mZ(i_mZ(r,r),9);
 clrscrn();
 printf(" Copy/Past into the octave window. \n\n");
 p_Octave_mZ(A,"A", P0 ,P0);
 printf(" det(A)\n\n\n");
 printf(" det(A) = ");
 p_Z(det_Z(A), S4,P0, S5,P0);
 printf("\n\n\n");
 f_mZ(A); 
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(RC5)+RC1);
} while(stop_w());
 return 0;
/* ------------------------------------ */

Exemple de sortie écran :
 Copy/Past into the octave window.
 A=[
+2-1*i,-6+2*i,-7-6*i;
-6+6*i,+7+8*i,+9-7*i;
+9-9*i,-2+6*i,+1-6*i]
 det(A)
 det(A) = +1175+2210i 
 Press return to continue.

Mathc complexes/a32
 <ns>0</ns>
 <revision>
 <parentid>698429</parentid>
 <timestamp>2023-06-12T12:53:36Z</timestamp>
 <contributor>
 <username>Xhungab</username>
 </contributor>
 <minor />
 <model>wikitext</model>
 <format>text/x-wiki</format>
Bibliothèque
Installer ce fichier dans votre répertoire de travail.
/* Save as : wg.h */
/* ------------------------------------ */
 Déclaration des fichiers h.

Mathc complexes/a33
Bibliothèque
Installer ce fichier dans votre répertoire de travail.
/* Save as : wgj3free.h */
void put_zeroR_mZ(
double **Ab,
double **Ab_free
int r, c, Abr, t;
 for(r=R1, Abr=R1, c=C1, t=C1; r<Ab_free[R_SIZE][C0]; r++, c=r+t++)
 if(Ab[Abr][c]> ERROR_E)
 c_r_mZ(Ab,Abr,Ab_free,r);
 Abr++; 
 if((Abr+R1)>Ab[R_SIZE][C0]) r = Ab_free[R_SIZE][C0];
/* ------------------------------------ */
void put_freeV_mR(
double **Ab_free
int r,c,t,cfree;
 for(r=R1,c=C1,t=C1,cfree=C2; r<Ab_free[R_SIZE][C0]; r++, c=r+t++)
 if(Ab_free[r][c]< ERROR_E)
 c_s_mZ(1.,Ab_free,r,c); 
 c_s_mZ(1.,Ab_free,r,Ab_free[C_SIZE_A][C0]+cfree);
 cfree += C2;
/* ------------------------------------ */
 Déclaration des fichiers h.

Mathc complexes/a34
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c00a.c */
/* ------------------------------------ */
void fun(int r)
double **Ab = r_singular_Ab_mZ(i_Abr_Ac_bc_mZ(r-R2,r,C1),999);
double **Ab_free = i_Abr_Ac_bc_mZ(r,r,C5);
double **b = i_mZ(r,C5);
 clrscrn();
 printf(" Ab :");
 p_mZ(Ab, S8,P2, S8,P2, C4); 
 printf(" gj_PP_FreeV_mZ(Ab) :");
 p_mZ(gj_PP_FreeV_mZ(Ab), S8,P4, S8,P4, C4); 
 stop(); 
 clrscrn(); 
 put_zeroR_mZ(Ab,Ab_free); 
 put_freeV_mR(Ab_free);
 printf(" put_zero_row_mZ(Ab,Ab_free);\n"
 " put_freeV_mR(Ab_free);\n\n"
 " Ab_free :");
 p_mZ(Ab_free, S8,P4, S8,P4, C4);
 stop(); 
 clrscrn(); 
 printf(" Copy/Past into the octave window.\n\n");
 p_Octave_mZ(Ab_free,"Ab_free",P10, P10);
 printf(" rref(Ab_free.00000000001)\n\n");
 stop(); 
 clrscrn(); 
 printf(" gj_mZ(Ab) :");
 p_mZ(gj_mZ(Ab_free), S8,P4, S8,P4, C4); 
 stop(); 
 clrscrn(); 
 printf(" new_b : free variables"); 
 p_mZ(c_Ab_b_mZ(Ab_free,b), S8,P4, S8,P4, C4); 
 f_mZ(Ab);
 f_mZ(Ab_free);
 f_mZ(b); 
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(R5);
} while(stop_w());
 return 0;
/* ------------------------------------ */
J'ai essayé de rendre cet exemple le plus générique possible.
La matrice A a 5 colonnes et 3 lignes. Elle peut donc de manière aléatoire avoir entre 2 et 4 variables libres.
double **Ab = r_singular_Ab_mZ(i_Abr_Ac_bc_mZ(R3,R5,C1),999);
La matrice Ab_free a 5 colonnes réservé pour b. Cela permet de gérer des matrices qui ont entre 2 et 4 variables libres. 5 colonnes c'est à dire 4 pour les variables libres et une pour b. Les colonnes de variables libres non utilisés sont nulles.
 double **Ab_free = i_Abr_Ac_bc_mZ(R5,R5,C5);
 Exemple de sortie écran :
 Ab :
 -641.00 +423.00i -271.00 +102.00i -679.00 +537.00i -300.00 -36.00i 
 -641.00 +423.00i -271.00 +102.00i -679.00 +537.00i -300.00 -36.00i 
 +612.00 -47.00i -973.00 -777.00i -453.00 -187.00i +811.00 +887.00i 
 +798.00 +44.00i -834.00 +836.00i 
 +798.00 +44.00i -834.00 +836.00i 
 -774.00 -532.00i +733.00 +193.00i 
 gj_PP_FreeV_mZ(Ab) :
 +1.0000 -0.0000i +0.3677 +0.0835i +1.1231 -0.0966i +0.3002 +0.2543i 
 -0.0000 -0.0000i +1.0000 +0.0000i +0.6784 -0.3952i -0.6394 -0.1889i 
 +0.0000 -0.0000i +0.0000 +0.0000i -0.0000 +0.0000i +0.0000 -0.0000i 
 -0.8357 -0.6201i +1.5059 -0.3104i 
 +0.2074 +0.0196i -0.0755 -0.3266i 
 +0.0000 +0.0000i +0.0000 -0.0000i 
 Press return to continue. 
 ------------------------------------ 
 put_zero_row_mZ(Ab,Ab_free);
 put_freeV_mR(Ab_free);
 Ab_free :
 +1.0000 -0.0000i +0.3677 +0.0835i +1.1231 -0.0966i +0.3002 +0.2543i 
 -0.0000 -0.0000i +1.0000 +0.0000i +0.6784 -0.3952i -0.6394 -0.1889i 
 +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i 
 -0.8357 -0.6201i +1.5059 -0.3104i +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.2074 +0.0196i -0.0755 -0.3266i +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i 
 +1.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i 
 +1.0000 +0.0000i +0.0000 +0.0000i 
 Press return to continue. 
 gj_mZ(Ab) :
 +1.0000 -0.0000i +0.0000 +0.0000i +0.0000 -0.0000i +0.0000 +0.0000i 
 -0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +1.5064 -0.1840i -0.8406 +0.0080i -0.5195 -0.3771i 
 +0.0000 +0.0000i -0.0755 -0.3266i -0.6784 +0.3952i +0.6394 +0.1889i 
 +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 -0.0000i -0.0000 -0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i 
 +1.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.9103 +0.6447i +0.0000 +0.0000i 
 -0.2074 -0.0196i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i 
 +1.0000 +0.0000i +0.0000 +0.0000i 
 Press return to continue. 
 new_b : free variables
 +1.5064 -0.1840i -0.8406 +0.0080i -0.5195 -0.3771i +0.9103 +0.6447i 
 -0.0755 -0.3266i -0.6784 +0.3952i +0.6394 +0.1889i -0.2074 -0.0196i 
 +0.0000 +0.0000i +1.0000 -0.0000i -0.0000 -0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i 
 +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 Press return to continue
 Press X to stop

Mathc complexes/a35
Application
Dans cet algorithme le pivot choisi est la plus grande norme qui se trouve dans une colonne de la matrice A. Pour cela on fait des échanges de lignes. Attention on ne touche pas à b.
Pour initialiser la matrice Ab il faut utiliser la commande : 
double **Ab = i_Abr_Ac_bc_mZ(RAb,CA,Cb);
Aléatoires :
Entrez vos données :