Mathc complexes/01p
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 = rdefinite_positive_mZ( i_mZ(RCA,RCA),99);
double **invA = invgj_mZ(A,i_mZ(RCA,RCA));
double **V = eigs_V_mZ(A,i_mZ(RCA,RCA),FACTOR_E);;
double **invV = i_mZ(RCA,RCA);
double **T = i_mZ(RCA,RCA);
double **EigsValue = i_mZ(RCA,RCA);
clrscrn();
printf(" A :");
p_mZ(A, S10,P4, S8,P4, C3);
printf(" invA :");
p_mZ(invA, S10,P4, S8,P4, C3);
stop();
clrscrn();
printf(" V :");
eigs_V_mZ(A,V,FACTOR_E);
pE_mZ(V, S12,P4, S12,P4, C3);
printf(" inv(V) :");
invgj_mZ(V,invV);
pE_mZ(invV, S12,P4, S12,P4, C3);
stop();
clrscrn();
printf(" Copy/Past into the octave windows \n\n\n");
p_Octave_mZ(A,"a",P9,P9);
printf(" [V, E] = eigs (a,%d) \n\n\n",RCA);
printf(" EigsValue = invV * A * V");
mul_mZ(invV,A,T);
mul_mZ(T,V,EigsValue);
p_mZ(EigsValue, S12,P4, S8,P4, C3);
f_mZ(A);
f_mZ(invA);
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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Ses valeurs propres sont positives. Elle est inversible.
Exemple de sortie écran :
A :
+65.8456 -0.0000i -25.4728-11.8478i +8.3213 +5.8238i
-25.4728+11.8478i +54.4409 -0.0000i +12.5268 +6.8414i
+8.3213 -5.8238i +12.5268 -6.8414i +37.7136 -0.0000i
invA :
+0.0235 -0.0000i +0.0140 +0.0059i -0.0088 -0.0081i
+0.0140 -0.0059i +0.0303 +0.0000i -0.0141 -0.0064i
-0.0088 +0.0081i -0.0141 +0.0064i +0.0355 +0.0000i
Press return to continue.
V :
+2.8989e-01 -7.1050e-01i +2.6120e-01 +3.4062e-01i -3.3955e-01 -3.3408e-01i
+5.3162e-02 +6.3578e-01i +4.5942e-01 +1.4608e-01i -5.5163e-01 -2.3721e-01i
+6.4148e-02 -8.9023e-19i +7.6377e-01 +0.0000e+00i +6.4229e-01 +0.0000e+00i
inv(V) :
+2.8989e-01 +7.1050e-01i +5.3162e-02 -6.3578e-01i +6.4148e-02 +3.3307e-16i
+2.6120e-01 -3.4062e-01i +4.5942e-01 -1.4608e-01i +7.6377e-01 -7.8932e-17i
-3.3955e-01 +3.3408e-01i -5.5163e-01 +2.3721e-01i +6.4229e-01 +6.0817e-17i
Press return to continue.
Copy/Past into the octave windows
a=[
+65.845550297-0.000000000*i,-25.472826980-11.847795164*i,+8.321250152+5.823849160*i;
-25.472826980+11.847795164*i,+54.440883245-0.000000000*i,+12.526769003+6.841402774*i;
+8.321250152-5.823849160*i,+12.526769003-6.841402774*i,+37.713566458-0.000000000*i]
[V, E] = eigs (a,3)
EigsValue = invV * A * V
+89.0000 +0.0000i +0.0000 -0.0000i +0.0000 +0.0000i
-0.0000 -0.0000i +52.0000 -0.0000i -0.0000 -0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +17.0000 -0.0000i
Press return to continue
Press X return to stop