Aller au contenu

Mathc complexes/021

Un livre de Wikilivres.

Application

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double s = rp_I(9);

double **A      =  rdefinite_negative_mZ(     i_mZ(r,r), 99);
double **sA     =                smul_mZ(s,A, i_mZ(r,r));

double **EValue =                eigs_mZ(sA,  i_mZ(r,C1));

  clrscrn();  
  printf(" A = Q D QT: ");
  p_mZ(A, S10,P3, S8,P3, C4);
  
  printf(" %+.0f*A   s > 0 ",s);
  p_mZ(sA, S10,P3, S8,P3, C4);
  
  printf(" %+.0f*A : EValue are negatives",s);
  p_mZ(EValue, S10,P3, S8,P3, C4);   
  
  f_mZ(A);
  f_mZ(sA);
  f_mZ(EValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R3)+R1);

} while(stop_w());

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


Si A est définie négative et si s est un réel strictement positif, alors s*A est définie négative.


Exemple de sortie écran :

 A = Q D QT: 
   -66.828  -0.000i     +9.770  -5.561i     +8.230  -1.822i     -6.388  +3.153i 
    +9.770  +5.561i    -56.168  +0.000i    -10.474  -1.022i     +2.384  -7.652i 
    +8.230  +1.822i    -10.474  +1.022i    -73.094  +0.000i     +6.321  -3.430i 
    -6.388  -3.153i     +2.384  +7.652i     +6.321  +3.430i    -62.910  +0.000i 

 +9*A   s > 0 
  -601.451  -0.000i    +87.932 -50.047i    +74.073 -16.400i    -57.493 +28.380i 
   +87.932 +50.047i   -505.513  +0.000i    -94.267  -9.197i    +21.456 -68.864i 
   +74.073 +16.400i    -94.267  +9.197i   -657.848  +0.000i    +56.886 -30.868i 
   -57.493 -28.380i    +21.456 +68.864i    +56.886 +30.868i   -566.188  +0.000i 

 +9*A : EValue are negatives
  -819.000  -0.000i 
  -558.000  +0.000i 
  -549.000  +0.000i 
  -405.000  -0.000i 


 Press   return to continue
 Press X return to stop