Aller au contenu

Mathc complexes/04a

Un livre de Wikilivres.

Application


Installer et compiler ces fichiers dans votre répertoire de travail.


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define   RC  RC5
/* ------------------------------------ */
void fun(void)
{
double **A          = r_mRZ(i_mZ(RC,RC),999.);
double **EigsValue  =       i_mZ(RC,C1);

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mZ(A,"a",P0,P4);  
  printf(" EigenValues  = eigs (a,%d)\n\n\n",RC);

  printf(" EigsValue :");
  eigs_mZ(A,EigsValue);  
  p_mZ(EigsValue, S15,P9, S15,P9, C5); 
       
  f_mZ(A);
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();
  
} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Exemple de sortie écran : Calculons la partie réelle du nombre complexe.
 Copy/Past into the octave windows 

 a=[
+32+0*i,+54+0*i,+87+0*i,-51+0*i;
-10+0*i,-57+0*i,-91+0*i,-38+0*i;
+5+0*i,+51+0*i,-58+0*i,+28+0*i;
+83+0*i,+57+0*i,+81+0*i,-89+0*i]

 EigenValues  = eigs (a,4)


 EigsValue :
 -79.0656058257  +0.0000000000i 
 +39.3392362679  +0.0000000000i 
 -56.6687439536  +0.0000000000i 
 -75.6048864886  +0.0000000000i 


 Press   return to continue
 Press X return to stop


Remarque :

* (-79.0656058257 +39.3392362679) / 2 = −19,863184779
* (-56.6687439536 -75.6048864886) / 2 = −66,136815221 


Octave :
EigenValues  = eigs (a,4)
EigenValues =

  -19.863 + 73.473i
  -19.863 - 73.473i
  -66.137 + 21.642i
  -66.137 - 21.642i