Aller au contenu

Mathc complexes/a111

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  
/* ------------------------------------ */       
/* ------------------------------------ */
double f(
double x)
{
        return(1.0/(x));
}
char  feq[] =  "1.0/(x)";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A             = rcsymmetric_mRZ(i_mZ(RCA,RCA),99.);
double **invA          =               i_mZ(RCA,RCA);

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

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

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

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mRZ(A,"a",P0);  
  printf("format short e\n");
  printf(" inv (a) \n\n");

  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(f,EigsValue,invEigsValue);

//A == EigsVector * EigsValue * T_EigsVector  
  mul_mZ(EigsVector,invEigsValue,T1);
  mul_mZ(T1,T_EigsVector,invA); 
  
  printf(" invA : EigsVector * invEigsValue * T_EigsVector"); 
  pE_mRZ(invA,S10,P4,C6); 
  
  printf(" Ide = A * invA ");  
  p_mRZ(mul_mZ(A,invA,T1),S10,P5,C10);     
   
  f_mZ(A);
  f_mZ(invA);
    
  f_mZ(EigsVector);
  f_mZ(T_EigsVector);
  
  f_mZ(EigsValue);
  f_mZ(invEigsValue);    
     
  f_mZ(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

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


              invA = V * inv(EValue) * cV_T


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

 a=[
+897,-1819,-2129;
-1819,+4971,+3751;
-2129,+3751,+6667]

format short e
 inv (a) 

 invA : EigsVector * invEigsValue * T_EigsVector
+1.2158e-02 +2.6401e-03 +2.3971e-03 
+2.6401e-03 +9.2288e-04 +3.2385e-04 
+2.3971e-03 +3.2385e-04 +7.3327e-04 

 Ide = A * invA 
  +1.00000   -0.00000   +0.00000 
  +0.00000   +1.00000   +0.00000 
  +0.00000   +0.00000   +1.00000 


 Press return to continue
 Press X      to stop