Mathc complexes/02e
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-3
#define RCA RC3
/* ------------------------------------ */
void fun(void)
{
double d[RCA*(RCA*C2)] ={
1,0, 0,0, 0,0,
0,0, 2,0, 0,0,
0,0, 0,0, 3,0};
double **D = ca_A_mZ(d, i_mZ(RCA,RCA));
//double **D = erase_i_mZ(rdiag_mZ( i_mZ(RCA,RCA),99));
double **A = rdefpos_diag_mZ(D, i_mZ(RCA,RCA),9);
double **V = eigs_V_mZ(A, i_mZ(RCA,RCA),FACTOR_E);
double **invV = inv_mZ(V, i_mZ(RCA,RCA));
double **T = i_mZ(RCA,RCA);
double **EigsValue = i_mZ(RCA,RCA);
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);
stop();
clrscrn();
printf(" A :");
p_mZ(A, S10,P4, S10,P4, C4);
printf(" V :");
pE_mZ(V, S10,P4, S10,P4, C4);
printf(" invV :");
pE_mZ(invV, S10,P4, S10,P4, C4);
stop();
clrscrn();
printf(" EigsValue = invV * A * V:");
mul_mZ(invV,A,T);
mul_mZ(T,V,EigsValue);
p_mZ(EigsValue, S10,P4, S8,P4, C4);
printf(" A :");
p_mZ(A, S10,P4, S10,P4, C4);
printf(" A = V * EigsValue * invV");
mul_mZ(V,EigsValue,T);
mul_mZ(T,invV,A);
p_mZ(A, S10,P4, S10,P4, C4);
f_mZ(D);
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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Choisir les valeurs propres : Valeurs propres réelles.
double **D = ca_A_mZ(d, i_mZ(RCA,RCA));
Permet de choisir les valeurs propres.
double **D = rdiag_mZ( i_mZ(RCA,RCA),99);
Cet exemple donne des valeurs propres aléatoires.
Exemple de sortie écran :
Copy/Past into the octave windows
a=[
+1.521284303+0.000000000*i,+0.560636914-0.182392706*i,-0.204750046-0.361192824*i;
+0.560636914+0.182392706*i,+1.861040067+0.000000000*i,+0.343261062-0.217272352*i;
-0.204750046+0.361192824*i,+0.343261062+0.217272352*i,+2.617675630+0.000000000*i]
[V, E] = eigs (a,3)
Press return to continue.
A :
+1.5213 +0.0000i +0.5606 -0.1824i -0.2048 -0.3612i
+0.5606 +0.1824i +1.8610 +0.0000i +0.3433 -0.2173i
-0.2048 +0.3612i +0.3433 +0.2173i +2.6177 +0.0000i
V :
-4.9166e-02-3.6441e-01i -2.3458e-01+4.4254e-01i +7.3131e-01+2.8127e-01i
+2.8053e-01-3.4320e-01i -2.1770e-01+6.4860e-01i -5.0629e-01-2.8127e-01i
+8.1750e-01+0.0000e+00i +5.3015e-01+9.1223e-18i +2.2502e-01-4.0350e-18i
invV :
-4.9166e-02+3.6441e-01i +2.8053e-01+3.4320e-01i +8.1750e-01+5.5511e-17i
-2.3458e-01-4.4254e-01i -2.1770e-01-6.4860e-01i +5.3015e-01-5.5511e-17i
+7.3131e-01-2.8127e-01i -5.0629e-01+2.8127e-01i +2.2502e-01+4.0246e-16i
Press return to continue.
EigsValue = invV * A * V:
+3.0000 +0.0000i -0.0000 +0.0000i +0.0000 -0.0000i
+0.0000 +0.0000i +2.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i -0.0000 +0.0000i +1.0000 +0.0000i
A :
+1.5213 +0.0000i +0.5606 -0.1824i -0.2048 -0.3612i
+0.5606 +0.1824i +1.8610 +0.0000i +0.3433 -0.2173i
-0.2048 +0.3612i +0.3433 +0.2173i +2.6177 +0.0000i
A = V * EigsValue * invV
+1.5213 -0.0000i +0.5606 -0.1824i -0.2048 -0.3612i
+0.5606 +0.1824i +1.8610 +0.0000i +0.3433 -0.2173i
-0.2048 +0.3612i +0.3433 +0.2173i +2.6177 +0.0000i
Press return to continue
Press X return to stop