Mathc complexes/a346
Apparence
Décomposition d'une matrice en éléments propres
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* save as : c00b.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-4
/* ------------------------------------ */
/* ------------------------------------ */
double f(
double x)
{
return(pow(x,1./3.));
}
char feq[] = "x**1/3";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A = rcsymmetric_mZ( i_mZ(rc,rc),9);
double **A_T = ctranspose_mZ(A, i_mZ(rc,rc));
double **U = X_U_mZ(A_T, i_mZ(rc,rc),FACTOR_E);
double **U_T = ctranspose_mZ(U, i_mZ(rc,rc));
double **U_TA = mul_mZ(U_T, A, i_mZ(rc,rc));
double **X = mul_mZ(U_TA, U, i_mZ(rc,rc));
double **SqrtA3X = f_eigs_mZ(f,X, i_mZ(rc,rc));
double **USqrtA3X = mul_mZ(U,SqrtA3X, i_mZ(rc,rc));
double **SqrtA3 = mul_mZ(USqrtA3X,U_T, i_mZ(rc,rc));
double **SqrtAP2 = mul_mZ(SqrtA3,SqrtA3, i_mZ(rc,rc));
double **SqrtAP3 = mul_mZ(SqrtAP2,SqrtA3,i_mZ(rc,rc));
clrscrn();
printf(" A :");
p_mZ(A, S9,P1, S8,P1, C4);
printf(" U :");
p_mZ(U, S9,P4, S8,P4, C4);
printf(" X = U_T * A * U :");
p_mZ(X, S11,P3, S7,P3, C4);
stop();
clrscrn();
printf(" sqrt(A,1/3) = U sqrt(X,1/3) T_U :");
p_mZ(SqrtA3, S11,P3, S7,P3, C4);
printf(" A = sqrt(A,1/3)**3 :");
p_mZ(SqrtAP3, S9,P1, S8,P1, C4);
printf(" A :");
p_mZ(A, S9,P1, S8,P1, C4);
f_mZ(A);
f_mZ(A_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(X);
f_mZ(SqrtA3X);
f_mZ(USqrtA3X);
f_mZ(SqrtA3);
f_mZ(SqrtAP2);
f_mZ(SqrtAP3);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R3);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+237.0 +0.0i +108.0 -16.0i -46.0 -153.0i
+108.0 +16.0i +120.0 +0.0i -10.0 -52.0i
-46.0 +153.0i -10.0 +52.0i +142.0 +0.0i
U :
-0.2204 -0.7200i -0.0002 -0.0865i +0.1731 +0.6290i
-0.0616 -0.3810i +0.0886 +0.8546i -0.0174 -0.3355i
+0.5330 +0.0000i +0.5043 +0.0000i +0.6794 +0.0000i
X = U_T * A * U :
+406.048 -0.000i +0.000 -0.000i +0.000 -0.000i
+0.000 +0.000i +78.381 -0.000i -0.000 +0.000i
+0.000 +0.000i -0.000 -0.000i +14.571 -0.000i
Press return to continue.
sqrt(A,1/3) = U sqrt(X,1/3) T_U :
+5.270 -0.000i +1.293 -0.210i -0.583 -1.984i
+1.293 +0.210i +4.538 +0.000i -0.081 -0.216i
-0.583 +1.984i -0.081 +0.216i +4.319 +0.000i
A = sqrt(A,1/3)**3 :
+237.0 -0.0i +108.0 -16.0i -46.0 -153.0i
+108.0 +16.0i +120.0 +0.0i -10.0 -52.0i
-46.0 +153.0i -10.0 +52.0i +142.0 -0.0i
A :
+237.0 +0.0i +108.0 -16.0i -46.0 -153.0i
+108.0 +16.0i +120.0 +0.0i -10.0 -52.0i
-46.0 +153.0i -10.0 +52.0i +142.0 +0.0i
Press return to continue
Press X return to stop