Aller au contenu

Mathc complexes/a153

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   RCA        RC3
#define FACTOR_E    +1.E-3
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A             = rEcsymmetric_mZ(i_mZ(RCA,RCA),555.,1E-3);
double **cos_A         =               i_mZ(RCA,RCA);

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

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

double **T1            =               i_mZ(RCA,RCA);
  
  clrscrn();
  printf(" A :");
  p_mZ(A,S10,P4,S10,P4,C6); 

  eigs_V_mZ(A,EigsVector,FACTOR_E);
  ctranspose_mZ(EigsVector,T_EigsVector);
      
/* EigsValue : T_EigsVector * A * EigsVector */
  mul_mZ(T_EigsVector,A,T1);
  mul_mZ(T1,EigsVector,EigsValue);     
  
  f_eigs_mZ(cos,EigsValue,cos_EigsValue);

//A == EigsVector * EigsValue * T_EigsVector  
  mul_mZ(EigsVector,cos_EigsValue,T1);
  mul_mZ(T1,T_EigsVector,cos_A); 

  printf(" cos(A) :");
  p_mZ(cos_A,S10,P4,S10,P4,C6); 

/* ================================================================== */ 

  eigs_V_mZ(cos_A,EigsVector,FACTOR_E);
  ctranspose_mZ(EigsVector,T_EigsVector);  
  
/* EigsValue : T_EigsVector * A * EigsVector */
  mul_mZ(T_EigsVector,cos_A,T1);
  mul_mZ(T1,EigsVector,EigsValue);     
  
  f_eigs_mZ(acos,EigsValue,cos_EigsValue);

//A == EigsVector * EigsValue * T_EigsVector  
  mul_mZ(EigsVector,cos_EigsValue,T1);
  mul_mZ(T1,T_EigsVector,A); 

  printf(" acos(cos(A)) = A :");
  p_mZ(A,S10,P4,S10,P4,C6);

  f_mZ(A);
  f_mZ(cos_A);

  f_mZ(EigsVector);
  f_mZ(T_EigsVector);
  
  f_mZ(EigsValue);  
  f_mZ(cos_EigsValue);    
      
  f_mZ(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
              acos(cos(A)) = A
Exemple de sortie écran :
 ------------------------------------
 A :
   +0.5399   +0.0000i    +0.2802   -0.2164i    -0.2789   -0.1380i 
   +0.2802   +0.2164i    +0.5184   +0.0000i    -0.0210   -0.4348i 
   -0.2789   +0.1380i    -0.0210   +0.4348i    +0.5777   +0.0000i 

 cos(A) :
   +0.7732   -0.0000i    -0.1582   +0.1501i    +0.1785   +0.1164i 
   -0.1582   -0.1501i    +0.7449   +0.0000i    +0.0301   +0.2509i 
   +0.1785   -0.1164i    +0.0301   -0.2509i    +0.7280   +0.0000i 

 acos(cos(A)) = A :
   +0.5399   -0.0000i    +0.2802   -0.2164i    -0.2789   -0.1380i 
   +0.2802   +0.2164i    +0.5184   -0.0000i    -0.0210   -0.4348i 
   -0.2789   +0.1380i    -0.0210   +0.4348i    +0.5777   +0.0000i 


 Press   return to continue
 Press X return to stop