Aller au contenu

Mathc complexes/01y

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_positive_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 positives",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 positive et si s est un réel strictement positif, alors s*A est définie positive.


Exemple de sortie écran :

 A = Q D QT: 
   +84.410  +0.000i     -0.406  -1.611i     +5.438  -0.686i     -2.822  +2.424i 
    -0.406  +1.611i    +75.351  -0.000i     +6.160  -0.169i     +2.817  +2.021i 
    +5.438  +0.686i     +6.160  +0.169i    +74.080  +0.000i     -7.158  -4.479i 
    -2.822  -2.424i     +2.817  -2.021i     -7.158  +4.479i    +80.159  +0.000i 

 +3*A   s > 0 
  +253.230  +0.000i     -1.217  -4.834i    +16.314  -2.058i     -8.466  +7.273i 
    -1.217  +4.834i   +226.052  -0.000i    +18.479  -0.506i     +8.452  +6.063i 
   +16.314  +2.058i    +18.479  +0.506i   +222.239  +0.000i    -21.473 -13.438i 
    -8.466  -7.273i     +8.452  -6.063i    -21.473 +13.438i   +240.478  +0.000i 

 +3*A : EValue are positives
  +273.000  -0.000i 
  +243.000  +0.000i 
  +237.000  +0.000i 
  +189.000  -0.000i 


 Press   return to continue
 Press X return to stop