Mathc matrices/c29a1
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c01.c |
---|
/* ------------------------------------ */
/* Save as : c01.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rsymmetric_mR(i_mR(r,r),999.);
double **EigsVector= i_mR(r,r);
double **EigsVector_T= i_mR(r,r);
double **b1= i_mR(r,C1);
double **b2= i_mR(r,C1);
double **b3= i_mR(r,C1);
double **r1= i_mR(R1,r);
double **r2= i_mR(R1,r);
double **r3= i_mR(R1,r);
double **b1r1= i_mR(r,r);
double **b2r2= i_mR(r,r);
double **b3r3= i_mR(r,r);
double **T = i_mR(r,r);
double **Ide= i_mR(r,r);
clrscrn();
printf(" A:");
p_mR(A, S5, P0, C6);
eigs_V_mR(A, EigsVector);
printf(" EigsVector:");
p_mR(EigsVector, S5, P6, C6);
transpose_mR(EigsVector,EigsVector_T);
printf(" Inverse of EigsVector = EigsVector_T");
pE_mR(EigsVector_T, S12, P4, C6);
c_c_mR(EigsVector, C1, b1, C1 );
c_c_mR(EigsVector, C2, b2, C1 );
c_c_mR(EigsVector, C3, b3, C1 );
c_r_mR(EigsVector_T, R1, r1, C1 );
c_r_mR(EigsVector_T, R2, r2, C1 );
c_r_mR(EigsVector_T, R3, r3, C1 );
stop();
clrscrn();
printf(" b1 \t\t\t\t 3*Rx1*C");
p_mR(b1, S12, P3, C6);
printf(" b2 ");
p_mR(b2, S12, P3, C6);
printf(" b3 ");
p_mR(b3, S12, P3, C6);
stop();
clrscrn();
printf(" r1 \t\t\t\t 1*Rx3*C");
p_mR(r1, S12, P3, C6);
printf(" r2 ");
p_mR(r2, S12, P3, C6);
printf(" r3 ");
p_mR(r3, S12, P3, C6);
stop();
clrscrn();
mul_mR(b1, r1, b1r1);
mul_mR(b2, r2, b2r2);
mul_mR(b3, r3, b3r3);
printf(" b1r1 \t\t\t\t 3*Rx1*C 1*Rx3*C = 3*Rx3*C");
p_mR(b1r1, S12, P3, C6);
printf(" b2r2 ");
p_mR(b2r2, S12, P3, C6);
printf(" b3r3 ");
p_mR(b3r3, S12, P3, C6);
stop();
clrscrn();
add_mR(b1r1, b2r2, T);
add_mR( T, b3r3, Ide);
printf(" b1r1 + b2r2 + b3r3 = Ide");
p_mR(Ide, S12, P3, C6);
f_mR(A);
f_mR(EigsVector);
f_mR(EigsVector_T);
f_mR(b1);
f_mR(b2);
f_mR(b3);
f_mR(r1);
f_mR(r2);
f_mR(r3);
f_mR(b1r1);
f_mR(b2r2);
f_mR(b3r3);
f_mR(T);
f_mR(Ide);
}
/* ------------------------------------ */
int main(void)
{
do
{
fun(R3);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous voyons une des propriètés de la décomposition spectral:
b1r1 + b2r2 + b3r3 = Ide b1r1 est obtenue en multipliant la première colonne de la matrice des vecteurs propres par la première ligne de la matrice inverse des vecteurs propres.
Vp invVp
r1
b1 b2 b3 r2 -> b1*r1; b2*r2; b3*r3; Cela nous donne trois matrices [3x3]
r3
Exemple de sortie écran :
A:
+479 +992 -843
+992 -763 +708
-843 +708 +88
EigsVector:
-0.481846 +0.848246 +0.219777
+0.736726 +0.256380 +0.625703
-0.474404 -0.463408 +0.748461
Inverse of EigsVector = EigsVector_T
-4.8185e-01 +7.3673e-01 -4.7440e-01
+8.4825e-01 +2.5638e-01 -4.6341e-01
+2.1978e-01 +6.2570e-01 +7.4846e-01
Press return to continue.
b1 3*Rx1*C
-0.482
+0.737
-0.474
b2
+0.848
+0.256
-0.463
b3
+0.220
+0.626
+0.748
Press return to continue.
r1 1*Rx3*C
-0.482 +0.737 -0.474
r2
+0.848 +0.256 -0.463
r3
+0.220 +0.626 +0.748
Press return to continue.
b1r1 3*Rx1*C 1*Rx3*C = 3*Rx3*C
+0.232 -0.355 +0.229
-0.355 +0.543 -0.350
+0.229 -0.350 +0.225
b2r2
+0.720 +0.217 -0.393
+0.217 +0.066 -0.119
-0.393 -0.119 +0.215
b3r3
+0.048 +0.138 +0.164
+0.138 +0.392 +0.468
+0.164 +0.468 +0.560
Press return to continue.
b1r1 + b2r2 + b3r3 = Ide
+1.000 +0.000 +0.000
+0.000 +1.000 +0.000
+0.000 +0.000 +1.000
Press return to continue
Press X return to stop