Mathc complexes/a175
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define TAB C2
#define RCA R3
/* ------------------------------------ */
void fun(void)
{
double **A[TAB];
double **InvA[TAB];
double **P = r_mZ( i_mZ(RCA,RCA),99);
double **InvP = inv_mZ(P,i_mZ(RCA,RCA) );
double **T = i_mZ(RCA,RCA);
double **P_1_InvA0_P = i_mZ(RCA,RCA);
int c;
for(c=C0; c<TAB; c++)
{
A[c] = i_mZ(RCA,RCA);
InvA[c] = i_mZ(RCA,RCA);
}
r_mZ(A[C0],99);
mul_mZ(InvP,A[C0],T);
mul_mZ(T,P,A[C0+C1]);
clrscrn();
printf(" The two similar matrices :\n\n"
" A[%d] = P**(-1) A[%d] P \n\n",C1,C0);
for(c=C0; c<TAB; c++)
{
printf(" A[%d] : ",c);
p_mZ(A[c],S12,P4,S12,P4,C6);
}
stop();
clrscrn();
printf(" The inverse of the two similar matrices : \n\n");
for(c=C0; c<TAB; c++)
{
printf(" InvA[%d] : ",c
);
pE_mZ(inv_mZ(A[c],InvA[c]),S12,P4,S11,P4,C6);
}
stop();
clrscrn();
mul_mZ(InvP,InvA[C0],T);
mul_mZ(T,P,P_1_InvA0_P);
printf(" InvA[%d] = P**(-1) InvA[%d] P \n\n",C1,C0);
printf(" InvA[%d] : ",C1);
pE_mZ(InvA[1],S12,P4,S11,P4,C6);
printf(" P**(-1) InvA[%d] P : ",C0);
pE_mZ(P_1_InvA0_P,S12,P4,S11,P4,C6);
for(c=C0; c<TAB; c++)
{
f_mZ(A[c]);
f_mZ(InvA[c]);
}
f_mZ(P);
f_mZ(InvP);
f_mZ(T);
f_mZ(P_1_InvA0_P);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do{
fun();
}while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Je crée une suite de deux Matrices semblables.
Exemple de sortie écran :
-------------------------------------------
The two similar matrices :
A[1] = P**(-1) A[0] P
A[0] :
-73.0000 +63.0000i -96.0000 -36.0000i -34.0000 -2.0000i
-47.0000 -25.0000i -5.0000 -95.0000i +68.0000 +5.0000i
+30.0000 +67.0000i +88.0000 -2.0000i +22.0000 -79.0000i
A[1] :
-236.7995 -143.2208i +106.5832 +85.3502i +152.3677 +45.5125i
-177.2947 +284.2601i +16.9742 -96.5831i -76.4140 -147.0676i
-62.2371 -333.4057i +41.4827 +165.0499i +163.8253 +128.8039i
Press return to continue.
-------------------------------------------
The inverse of the two similar matrices :
InvA[0] :
-5.5808e-03-7.2638e-03i +4.1355e-03-2.3909e-03i -1.6687e-04-5.8825e-03i
+1.5389e-03+2.9228e-03i -2.3637e-03+6.5115e-03i +4.6434e-03+1.7419e-03i
-5.4735e-03-4.3051e-03i +8.9070e-03-3.6105e-03i +1.3745e-04+2.4779e-03i
InvA[1] :
-5.1659e-03-2.9926e-04i -3.3495e-03-3.8725e-03i +2.5946e-03-5.1396e-03i
+5.1730e-03+1.5121e-02i -1.2297e-02-1.2227e-02i -1.2805e-02-2.2176e-02i
-1.7872e-03-1.8262e-02i +1.8925e-03+5.7091e-03i +9.6557e-03+1.4252e-02i
Press return to continue.
-------------------------------------------
InvA[1] = P**(-1) InvA[0] P
InvA[1] :
-5.1659e-03-2.9926e-04i -3.3495e-03-3.8725e-03i +2.5946e-03-5.1396e-03i
+5.1730e-03+1.5121e-02i -1.2297e-02-1.2227e-02i -1.2805e-02-2.2176e-02i
-1.7872e-03-1.8262e-02i +1.8925e-03+5.7091e-03i +9.6557e-03+1.4252e-02i
P**(-1) InvA[0] P :
-5.1659e-03-2.9926e-04i -3.3495e-03-3.8725e-03i +2.5946e-03-5.1396e-03i
+5.1730e-03+1.5121e-02i -1.2297e-02-1.2227e-02i -1.2805e-02-2.2176e-02i
-1.7872e-03-1.8262e-02i +1.8925e-03+5.7091e-03i +9.6557e-03+1.4252e-02i
Press return to continue
Press X return to stop