Mathc complexes/01b
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
#define RCA RC3
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = i_mZ(RCA,RCA);
double **V = i_mZ(RCA,RCA);
double **invV = i_mZ(RCA,RCA);
double **T = i_mZ(RCA,RCA);
double **EigsValue = i_mZ(RCA,RCA);
do
{
rlower_mZ(A,99);
eigs_V_mZ(A,V,FACTOR_E);
}while(!det_Z(V).r||!det_Z(V).i);
clrscrn();
printf(" Copy/Past into the octave windows \n\n\n");
p_Octave_mZ(A,"a",P0,P0);
printf(" [V, E] = eigs (a,%d) \n\n\n",RCA);
printf(" V :");
pE_mZ(V, S12,P4, S12,P4, C3);
printf(" inv(V) ... Some time the matrix is not invertible :");
pE_mZ(invgj_mZ(V,invV), S12,P4, S12,P4, C3);
stop();
clrscrn();
printf(" A :");
p_mZ(A, S12,P4, S12,P4, C3);
printf(" EigsValue = invV * A * V");
mul_mZ(invV,A,T);
mul_mZ(T,V,EigsValue);
p_mZ(clean_eyes_mZ(EigsValue), S12,P4, S8,P4, C3);
printf(" A = V * EigsValue * invV");
mul_mZ(V,EigsValue,T);
mul_mZ(T,invV,A);
p_mZ(A, S12,P4, S12,P4, C3);
f_mZ(A);
f_mZ(V);
f_mZ(invV);
f_mZ(T);
f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Valeurs propres vecteurs propres d'une matrice triangulaire inférieur
Remarque :
- Je n'ai pas les même vecteurs propres que octave.
- Mais je parviens cependant à calculer les valeurs propres (EigsValue = invV * A * V), et a retrouver la matrice A (A = V * EigsValue * invV).
Exemple de sortie écran :
Copy/Past into the octave windows
a=[
+39+23*i,+0+0*i,+0+0*i;
-84-34*i,+98+54*i,+0+0*i;
-8+24*i,+47-42*i,-88-45*i]
[V, E] = eigs (a,3)
V :
-1.2225e-15 +8.0840e-15i +0.0000e+00 +0.0000e+00i +2.3075e-01 +5.2479e-01i
+3.3067e-01 +8.9918e-01i +0.0000e+00 +0.0000e+00i +3.8286e-01 +6.7897e-01i
+2.8660e-01 +0.0000e+00i +1.0000e+00 +0.0000e+00i +2.5252e-01 +0.0000e+00i
inv(V) ... Some time the matrix is not invertible :
-3.5555e-01 +1.3740e+00i +3.6026e-01 -9.7964e-01i +0.0000e+00 +0.0000e+00i
-7.5401e-02 +9.4552e-03i -1.0325e-01 +2.8076e-01i +1.0000e+00 +0.0000e+00i
+7.0212e-01 -1.5968e+00i -1.1814e-14 +9.0568e-15i +0.0000e+00 +0.0000e+00i
Press return to continue.
A :
+39.0000 +23.0000i +0.0000 +0.0000i +0.0000 +0.0000i
-84.0000 -34.0000i +98.0000 +54.0000i +0.0000 +0.0000i
-8.0000 +24.0000i +47.0000 -42.0000i -88.0000 -45.0000i
EigsValue = invV * A * V
+98.0000+54.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i -88.0000-45.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +39.0000+23.0000i
A = V * EigsValue * invV
+39.0000 +23.0000i +0.0000 +0.0000i +0.0000 +0.0000i
-84.0000 -34.0000i +98.0000 +54.0000i +0.0000 +0.0000i
-8.0000 +24.0000i +47.0000 -42.0000i -88.0000 -45.0000i
Press return to continue
Press X return to stop