Aller au contenu

Mathc complexes/038

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-4         
#define RCA          RC6  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*(RCA*C2)] ={   
+23.037247782,-0.000000000, -9.054210143,-4.760094043, +7.055780246,-8.116625940, +5.837328527,+3.181102856, -5.497293954,+1.987290486, -3.853659006,-3.688738932, 
-9.054210143,+4.760094043, +21.661298903,+0.000000000, -0.063767253,+2.540467712, -0.356099425,+12.951777333, -0.578233130,+5.883310886, +7.278478707,-7.059870759, 
+7.055780246,+8.116625940, -0.063767253,-2.540467712, +41.444943135,-0.000000000, -11.011924524,-22.763984410, +4.447732552,-27.866895323, +1.844442206,-1.924521124, 
+5.837328527,-3.181102856, -0.356099425,-12.951777333, -11.011924524,+22.763984410, +42.110215120,+0.000000000, +20.713304065,+9.756936697, -11.927657780,-5.975712843, 
-5.497293954,-1.987290486, -0.578233130,-5.883310886, +4.447732552,+27.866895323, +20.713304065,-9.756936697, +42.740823156,+0.000000000, +0.112009750,+7.491403896, 
-3.853659006,+3.688738932, +7.278478707,+7.059870759, +1.844442206,+1.924521124, -11.927657780,+5.975712843, +0.112009750,-7.491403896, +34.005471906,-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);
  stop();
  
  clrscrn();
  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=[
+23.037247782-0.000000000*i,-9.054210143-4.760094043*i,+7.055780246-8.116625940*i,+5.837328527+3.181102856*i,-5.497293954+1.987290486*i,-3.853659006-3.688738932*i;
-9.054210143+4.760094043*i,+21.661298903+0.000000000*i,-0.063767253+2.540467712*i,-0.356099425+12.951777333*i,-0.578233130+5.883310886*i,+7.278478707-7.059870759*i;
+7.055780246+8.116625940*i,-0.063767253-2.540467712*i,+41.444943135-0.000000000*i,-11.011924524-22.763984410*i,+4.447732552-27.866895323*i,+1.844442206-1.924521124*i;
+5.837328527-3.181102856*i,-0.356099425-12.951777333*i,-11.011924524+22.763984410*i,+42.110215120+0.000000000*i,+20.713304065+9.756936697*i,-11.927657780-5.975712843*i;
-5.497293954-1.987290486*i,-0.578233130-5.883310886*i,+4.447732552+27.866895323*i,+20.713304065-9.756936697*i,+42.740823156+0.000000000*i,+0.112009750+7.491403896*i;
-3.853659006+3.688738932*i,+7.278478707+7.059870759*i,+1.844442206+1.924521124*i,-11.927657780+5.975712843*i,+0.112009750-7.491403896*i,+34.005471906-0.000000000*i]

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

 Press return to continue. 


 V :
   +0.0472 -0.0305i    -0.3753 -0.2176i    +0.5549 +0.2953i    -0.0601 -0.3678i 
   -0.0358 -0.1350i    +0.3886 -0.1975i    -0.2947 -0.1076i    -0.4218 +0.0222i 
   +0.2788 +0.4857i    -0.0064 -0.3123i    -0.0172 +0.1230i    -0.4521 -0.3000i 
   -0.5611 +0.0519i    -0.2410 -0.2193i    +0.2069 -0.1780i    +0.1740 +0.1319i 
   -0.4598 +0.3367i    +0.1809 +0.0620i    +0.2151 +0.1181i    -0.4732 +0.2943i 
   +0.1461 +0.0000i    +0.6176 +0.0000i    +0.5970 +0.0000i    +0.1737 -0.0000i 

   -0.0601 +0.1285i    -0.4652 -0.1951i 
   +0.1630 +0.5438i    -0.3752 -0.2251i 
   -0.0201 +0.1228i    +0.4052 +0.3152i 
   +0.0323 +0.5181i    +0.4202 -0.0900i 
   -0.1936 -0.3835i    -0.0450 -0.2851i 
   +0.4338 +0.0000i    +0.1501 -0.0000i 

 EigsValue :
  +96.0000 +0.0000i 
  +53.0000 -0.0000i 
  +25.0000 +0.0000i 
  +19.0000 +0.0000i 
  +12.0000 -0.0000i 
   +0.0000 +0.0000i 

 Press return to continue.