Mathc complexes/a37
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **Ab = r_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_mZ(Ab) :");
p_mZ(gj_PP_mZ(Ab), S8,P4, S8,P4, C4);
stop();
clrscrn();
put_zeroR_mZ(Ab,Ab_free);
put_freeV_mZ(Ab_free);
printf(" put_zero_row_mZ(Ab,Ab_free);\n"
" put_freeV_mZ(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 :
+987.00 +365.00i -103.00 +942.00i +455.00 +889.00i +90.00 -686.00i
+794.00 +937.00i -280.00 -34.00i -11.00 +81.00i +349.00 +111.00i
+993.00 -2.00i -585.00 +232.00i +792.00 -193.00i +383.00 -776.00i
+127.00 +201.00i -716.00 -414.00i
+205.00 -578.00i -574.00 -523.00i
+61.00 +944.00i -598.00 -212.00i
gj_PP_mZ(Ab) :
+1.0000 +0.0000i -0.1685 +0.1560i +0.0445 +0.0495i +0.2527 -0.1584i
+0.0000 +0.0000i +1.0000 +0.0000i +1.0209 -0.3606i -0.7532 +0.1490i
+0.0000 +0.0000i -0.0000 +0.0000i +1.0000 +0.0000i +0.0251 -0.4241i
-0.2511 -0.4316i -0.6270 +0.0813i
+0.8649 -0.1334i -0.3172 +0.0345i
+0.1112 +1.1357i -0.0005 -0.2227i
Press return to continue.
------------------------------------
put_zero_row_mZ(Ab,Ab_free);
put_freeV_mZ(Ab_free);
Ab_free :
+1.0000 +0.0000i -0.1685 +0.1560i +0.0445 +0.0495i +0.2527 -0.1584i
+0.0000 +0.0000i +1.0000 +0.0000i +1.0209 -0.3606i -0.7532 +0.1490i
+0.0000 +0.0000i -0.0000 +0.0000i +1.0000 +0.0000i +0.0251 -0.4241i
+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.2511 -0.4316i -0.6270 +0.0813i +0.0000 +0.0000i +0.0000 +0.0000i
+0.8649 -0.1334i -0.3172 +0.0345i +0.0000 +0.0000i +0.0000 +0.0000i
+0.1112 +1.1357i -0.0005 -0.2227i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i
+1.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 +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i
+0.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 -0.6370 +0.1722i -0.2173 -0.0565i +0.3378 +0.7521i
+0.0000 +0.0000i -0.2364 +0.2617i +0.6259 -0.5911i -0.3418 +1.2528i
-0.0000 -0.0000i -0.0005 -0.2227i -0.0251 +0.4241i -0.1112 -1.1357i
+0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i +0.0000 +0.0000i
+1.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 +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i
Press return to continue.
------------------------------------
new_b : free variables
-0.6370 +0.1722i -0.2173 -0.0565i +0.3378 +0.7521i +0.0000 +0.0000i
-0.2364 +0.2617i +0.6259 -0.5911i -0.3418 +1.2528i -0.0000 +0.0000i
-0.0005 -0.2227i -0.0251 +0.4241i -0.1112 -1.1357i +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
+0.0000 +0.0000i
Press return to continue
Press X to stop