Aller au contenu

Mathc complexes/02w

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 FACTOR_E    +1.E-2         
#define RCA          RC3  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*(RCA*C2)] ={   
+0.651225366,+0.000000000,-0.158846132,+0.418635744,-0.237811929,-0.039640695,
-0.158846132,-0.418635744,+1.100413236,+0.000000000,+0.151406646,-0.788515806,
-0.237811929,+0.039640695,+0.151406646,+0.788515806,+1.248361398,+0.000000000
};
                       
double **A =     ca_A_mZ(a, i_mZ(RCA,RCA));
double **V =                i_mZ(RCA,RCA);
double **EigsValue  =       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"
         " [V, E]  = eigs (a,%d)\n\n", RCA);

  eigs_V_mZ(A,V,FACTOR_E);
  printf(" V :");
  p_mZ(V, S10,P4, S8,P4, C4);  

  eigs_mZ(A,EigsValue);
  printf(" EigsValue :");
  p_mZ(EigsValue, S10,P4, S8,P4, C4); 
  stop();
    
  f_mZ(A);
  f_mZ(V);    
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
    fun();

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


Exemple de référence :  Il permet de vérifier les calculs.


Exemple de sortie écran :
 Copy/Past into the octave windows 

 a=[
+0.651225366+0.000000000*i,-0.158846132+0.418635744*i,-0.237811929-0.039640695*i;
-0.158846132-0.418635744*i,+1.100413236+0.000000000*i,+0.151406646-0.788515806*i;
-0.237811929+0.039640695*i,+0.151406646+0.788515806*i,+1.248361398+0.000000000*i]

 format short e
 [V, E]  = eigs (a,3)

 V :
   +0.0647 +0.1075i    -0.6799 -0.3969i    +0.5588 +0.2286i 
   +0.1584 -0.6729i    -0.1525 +0.3486i    -0.0762 +0.6096i 
   +0.7116 +0.0000i    +0.4853 +0.0000i    +0.5080 +0.0000i 

 EigsValue :
   +2.0000 -0.0000i 
   +1.0000 +0.0000i 
   -0.0000 -0.0000i 

 Press return to continue.