Mathc complexes/02g
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-2
#define RCA RC3
/* ------------------------------------ */
void fun(void)
{
double d[RCA*(RCA*C2)] ={
4,2, 0,0, 0,0,
0,0, 3,3, 0,0,
0,0, 0,0, 5,5};
double **D = ca_A_mZ(d, i_mZ(RCA,RCA));
//double **D = 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);
mul_mZ(invV,A,T);
mul_mZ(T,V,EigsValue);
printf(" EigsValue = invV * A * V:");
p_mZ(EigsValue, S10,P4, S8,P4, C4);
stop();
clrscrn();
printf(" A :");
p_mZ(A, S10,P4, S10,P4, C4);
mul_mZ(V,EigsValue,T);
mul_mZ(T,invV,A);
printf(" A = V * EigsValue * invV");
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 complexes. :
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=[
+3.293646267+2.882123634*i,-0.352198573+0.713591246*i,-0.149313252+0.085957657*i;
+0.104537748-0.088824088*i,+4.496135848+3.961156424*i,+1.338883270-0.689850384*i;
+0.217644900+0.772497447*i,-1.216599355+0.417072570*i,+4.210217885+3.156719942*i]
[V, E] = eigs (a,3)
Press return to continue.
A :
+3.2936 +2.8821i -0.3522 +0.7136i -0.1493 +0.0860i
+0.1045 -0.0888i +4.4961 +3.9612i +1.3389 -0.6899i
+0.2176 +0.7725i -1.2166 +0.4171i +4.2102 +3.1567i
V :
+1.9817e-01-6.8336e-02i -2.7217e-01-3.6289e-01i +2.2524e-01+8.3640e-01i
-3.2180e-02-7.8313e-01i +1.3608e-01+4.9897e-01i -2.2047e-01+2.6378e-01i
+5.8458e-01+0.0000e+00i +7.2577e-01+0.0000e+00i +3.6265e-01+0.0000e+00i
invV :
+1.9817e-01+6.8336e-02i -3.2180e-02+7.8313e-01i +5.8458e-01+4.1633e-15i
-2.7217e-01+3.6289e-01i +1.3608e-01-4.9897e-01i +7.2577e-01-4.3299e-15i
+2.2524e-01-8.3640e-01i -2.2047e-01-2.6378e-01i +3.6265e-01+1.9429e-15i
EigsValue = invV * A * V:
+5.0000 +5.0000i +0.0000 -0.0000i -0.0000 -0.0000i
+0.0000 +0.0000i +4.0000 +2.0000i +0.0000 -0.0000i
+0.0000 -0.0000i +0.0000 -0.0000i +3.0000 +3.0000i
Press return to continue.
A :
+3.2936 +2.8821i -0.3522 +0.7136i -0.1493 +0.0860i
+0.1045 -0.0888i +4.4961 +3.9612i +1.3389 -0.6899i
+0.2176 +0.7725i -1.2166 +0.4171i +4.2102 +3.1567i
A = V * EigsValue * invV
+3.2936 +2.8821i -0.3522 +0.7136i -0.1493 +0.0860i
+0.1045 -0.0888i +4.4961 +3.9612i +1.3389 -0.6899i
+0.2176 +0.7725i -1.2166 +0.4171i +4.2102 +3.1567i
Press return to continue
Press X return to stop