Mathc complexes/005
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-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
{
r_mZ(A,99);
eigs_V_mZ(A,V,FACTOR_E);
}while(!det_Z(V).r);
clrscrn();
printf(" A :");
p_mZ(A, S10,P4, S8,P4, C3);
printf(" V :");
eigs_V_mZ(A,V,FACTOR_E);
pE_mZ(V, S12,P4, S12,P4, C3);
printf(" inv(V) ... Some time the matrix is not invertible :");
inv_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",P0,P0);
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);
pE_mZ(clean_eyes_mZ(EigsValue), S12,P4, S8,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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
-1.0000+40.0000i +33.0000+48.0000i +60.0000-76.0000i
+62.0000-92.0000i +29.0000-67.0000i +98.0000+88.0000i
-71.0000-88.0000i +10.0000-24.0000i -11.0000-27.0000i
V :
-6.5632e-02 +1.6728e-01i +4.1737e-01 +1.3718e-01i -5.1211e-01 -5.2767e-01i
+6.3311e-01 +6.5882e-01i -7.8914e-01 +1.4582e-01i +3.8103e-01 +3.8495e-02i
+3.6447e-01 +2.4534e-17i +4.0371e-01 +0.0000e+00i +5.5915e-01 -2.7159e-17i
inv(V) ... Some time the matrix is not invertible :
+1.2620e-01 -8.4573e-01i +5.6077e-01 -5.0187e-01i +4.9701e-01 -3.5210e-01i
+5.6783e-01 -1.6763e-01i -4.4944e-01 +1.0264e-01i +9.9158e-01 +3.4333e-01i
-4.9223e-01 +6.7229e-01i -4.1021e-02 +2.5302e-01i +7.4855e-01 -1.8377e-02i
Press return to continue.
Copy/Past into the octave windows
a=[
-1+40*i,+33+48*i,+60-76*i;
+62-92*i,+29-67*i,+98+88*i;
-71-88*i,+10-24*i,-11-27*i]
[V, E] = eigs (a,3)
EigsValue = invV * A * V
+1.0293e+02-6.7354e+01i +0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i -6.5377e+01-9.1579e+01i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i -2.0552e+01+1.0493e+02i
Press return to continue
Press X return to stop