Aller au contenu

Mathc complexes/a106

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           RC4  
/* ------------------------------------ */       
void fun(void)
{
double **A             = rcsymmetric_mRZ(i_mZ(RCA,RCA),99.);
double **SqrtA         =                 i_mZ(RCA,RCA);

double **EigsVector    =                 i_mZ(RCA,RCA);
double **T_EigsVector  =                 i_mZ(RCA,RCA);

double **EigsValue     =                 i_mZ(RCA,RCA);
double **f_EigsValue   =                 i_mZ(RCA,RCA);

double **T1            =                 i_mZ(RCA,RCA);

  clrscrn();
  printf(" A ");   
  p_mRZ(A, S8,P0, C6);   
 
  eigs_V_mZ(A,EigsVector,FACTOR_E);
  transpose_mZ(EigsVector,T_EigsVector);
      
/* EigsValue : T_EigsVector * A * EigsVector */
  mul_mZ(T_EigsVector,A,T1);
  mul_mZ(T1,EigsVector,EigsValue);     
  
  f_eigs_mZ(sqrt,EigsValue,f_EigsValue);

 //A == EigsVector * EigsValue * T_EigsVector       
  mul_mZ(EigsVector,f_EigsValue,T1);
  mul_mZ(T1,T_EigsVector,SqrtA);  
  
  
  
  printf(" sqrt(A) = EigsVector * sqrt(EigsValue) * T_EigsVector");
  p_mRZ(SqrtA, S9,P3, C6);     
  
  printf(" A = sqrt(A) * sqrt(A)");  
  mul_mZ(SqrtA,SqrtA,A);
  p_mRZ(A, S8,P0, C6); 
   
  f_mZ(A);
  f_mZ(SqrtA);
    
  f_mZ(EigsVector);
  f_mZ(T_EigsVector);
  
  f_mZ(EigsValue);
  f_mZ(f_EigsValue);    
     
  f_mZ(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

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


              Sqrt(A)== V * sqrt(EValue)* T_V


Exemple de sortie écran :
 ------------------------------------
 A 
  +11764    -6124     -826    -4482 
   -6124   +11317    +2360    -4867 
    -826    +2360   +27818    -4778 
   -4482    -4867    -4778   +12015 

 sqrt(A) = EigsVector * sqrt(EigsValue) * T_EigsVector
  +98.350   -35.729    -4.145   -28.241 
  -35.729   +95.563    +6.473   -29.432 
   -4.145    +6.473  +165.668   -17.696 
  -28.241   -29.432   -17.696  +100.190 

 A = sqrt(A) * sqrt(A)
  +11764    -6124     -826    -4482 
   -6124   +11317    +2360    -4867 
    -826    +2360   +27818    -4778 
   -4482    -4867    -4778   +12015 


 Press return to continue
 Press X      to stop