Mathc complexes/02f
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 **EigsValue = eigs_mZ(A, i_mZ(RCA,C1));
clrscrn();
printf(" Copy/Past into the octave windows \n\n");
p_Octave_mZ(A,"a",P9,P9);
printf(" format short e\n"
" E = eigs (a,%d)\n", RCA);
printf(" EigsValue :");
p_mZ(EigsValue, S10,P4, S10,P4, C4);
printf(" D :");
p_mZ(D, S10,P4, S10,P4, C4);
f_mZ(D);
f_mZ(A);
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 :
a=[
+4.413103939+4.055209202*i,+1.231672144-0.499075391*i,+0.362424584+0.535488301*i;
-0.730654339+0.368514249*i,+3.970406386+2.854616913*i,-0.824220091+0.673805611*i;
+0.851277775+0.888740374*i,+0.147489822+0.123148330*i,+3.616489675+3.090173885*i]
format short e
E = eigs (a,3)
EigsValue :
+5.0000 +5.0000i
+4.0000 +2.0000i
+3.0000 +3.0000i
D :
+4.0000 +2.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +3.0000 +3.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +5.0000 +5.0000i
Press return to continue
Press X return to stop