Aller au contenu

Mathc complexes/a112

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

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

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

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

double **T1            =               i_mZ(RCA,RCA);
  
  clrscrn();
  printf(" A :");
  p_mRZ(A, S10,P0, C6); 
  stop();

  clrscrn();
  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,sin_EigsValue);
  f_eigs_mZ(g,EigsValue,cos_EigsValue);

//A == EigsVector * EigsValue * T_EigsVector  
  mul_mZ(EigsVector,sin_EigsValue,T1);
  mul_mZ(T1,T_EigsVector,sin_A);
   
  printf(" sin(A)**2");
  p_mRZ(sin_A,S10,P4,C6); 

//A == EigsVector * EigsValue * T_EigsVector  
  mul_mZ(EigsVector,cos_EigsValue,T1);
  mul_mZ(T1,T_EigsVector,cos_A); 
  
  printf(" cos(A)**2");
  p_mRZ(cos_A,S10,P4,C6); 
            
  add_mZ(sin_A,cos_A,Ide);
  
  printf(" Ide : cos(A)**2 + sin(A)**2");
  p_mRZ(Ide,S10,P4,C6);        
   
  f_mZ(A);
  f_mZ(sin_A);
  f_mZ(cos_A);
  
  f_mZ(Ide);
    
  f_mZ(EigsVector);
  f_mZ(T_EigsVector);
  
  f_mZ(EigsValue);
  f_mZ(cos_EigsValue);    
  f_mZ(sin_EigsValue);    
      
  f_mZ(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

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


              cos(A)**2 + sin(A)**2 = 1


Exemple de sortie écran :
 ------------------------------------
 A :
    +10334      +5253     +10270      +7494 
     +5253     +12111      -2950       -935 
    +10270      -2950     +18259      +8918 
     +7494       -935      +8918     +15061 

 Press return to continue. 


 ------------------------------------
 sin(A)**2
   +0.5841    +0.0940    -0.2353    -0.1128 
   +0.0940    +0.9070    -0.0616    -0.0130 
   -0.2353    -0.0616    +0.3428    -0.0464 
   -0.1128    -0.0130    -0.0464    +0.2938 

 cos(A)**2
   +0.4159    -0.0940    +0.2353    +0.1128 
   -0.0940    +0.0930    +0.0616    +0.0130 
   +0.2353    +0.0616    +0.6572    +0.0464 
   +0.1128    +0.0130    +0.0464    +0.7062 

 Ide : cos(A)**2 + sin(A)**2
   +1.0000    +0.0000    +0.0000    -0.0000 
   +0.0000    +1.0000    -0.0000    -0.0000 
   +0.0000    -0.0000    +1.0000    -0.0000 
   -0.0000    -0.0000    -0.0000    +1.0000 


 Press return to continue
 Press X      to stop