Aller au contenu

Mathc complexes/a340

Un livre de Wikilivres.


X Value Decomposition

Installer et compiler ces fichiers dans votre répertoire de travail.

c00d.c
/* ------------------------------------ */
/*  Save as :   c00d.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RCA             RC3
#define FACTOR_E        +1.E-0   
/* ------------------------------------ */
/* ------------------------------------ */
double **X_Cosh2A_mZ(
double **M_Value,
double **Cosh2A_Value
)
{
int  r;
int  c;

nb_Z Cosh2A;

  for (   r=R1; r<M_Value[R_SIZE][C0]; r++)
    for ( c=C1; c<M_Value[C_SIZE][C0]; c+=C2)

        if(((r-R1)*C2)==c-C1)
          {
           Cosh2A = cosh_Z(i_Z(2.*M_Value[r][c],2.*M_Value[r][c+C1]));
           
           Cosh2A_Value[r][c   ] = Cosh2A.r;
           Cosh2A_Value[r][c+C1] = Cosh2A.i;
          }
              
 return(Cosh2A_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **X_CoshAP2_pls_SinAP2_mZ(
double **M_Value,
double **CoshAP2_pls_SinAP2_Value
)
{
int  r;
int  c;

nb_Z CoshAP2_pls_SinAP2;

nb_Z Cosh;
nb_Z CoshP2;

nb_Z Sin;
nb_Z SinP2;

  for (   r=R1; r<M_Value[R_SIZE][C0]; r++)
    for ( c=C1; c<M_Value[C_SIZE][C0]; c+=C2)

        if(((r-R1)*C2)==c-C1)
          {
           Cosh   = cosh_Z(i_Z(M_Value[r][c],M_Value[r][c+C1]));
           CoshP2 = mul_Z(Cosh,Cosh);			  
			  
           Sin   = sin_Z(i_Z(M_Value[r][c],M_Value[r][c+C1]));
           SinP2 = mul_Z(Sin,Sin);
           
           CoshAP2_pls_SinAP2 = add_Z(CoshP2,SinP2);
           
           CoshAP2_pls_SinAP2_Value[r][c   ] = CoshAP2_pls_SinAP2.r;
           CoshAP2_pls_SinAP2_Value[r][c+C1] = CoshAP2_pls_SinAP2.i;
          }
              
 return(CoshAP2_pls_SinAP2_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
int r = RCA;
int c = RCA;
  
double **A =           rE_mZ(i_mZ(r,c),99,+1.E-4);

double **A_T = ctranspose_mZ(A,i_mZ(c,r));
double **V =                   i_mZ(r,c);
double **V_T =                 i_mZ(c,r);
double **U =                   i_mZ(r,c);
double **U_T =                 i_mZ(c,r);  
double **U_TA =                i_mZ(c,c);  
double **X =                   i_mZ(c,c);  

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

double **CoshAP2_pls_SinAP2 =   i_mZ(c,c);
double **Cosh2A             =   i_mZ(c,c);

  clrscrn();
  printf(" A :");
  p_mZ(A, S9,P4, S8,P4, C3);
        
  printf(" U :");
  X_U_mZ(A_T,U,FACTOR_E);
  p_mZ(U, S9,P4, S8,P4, C3);

  printf(" V :");
  X_V_mZ(A_T,V,FACTOR_E);
  p_mZ(V, S9,P4, S8,P4, C3);
  
   ctranspose_mZ(U,U_T);
   ctranspose_mZ(V,V_T);  
   
   printf(" X = U_T * A * V :");
   mul_mZ(U_T, A, U_TA);                       
   mul_mZ(U_TA, V, X);   
   p_mZ(X, S9,P4, S8,P4, C3);
   stop();

   clrscrn();      
   printf(" cosh(2 A)        :");
   X_Cosh2A_mZ(X,Cosh2A);
   
   mul_mZ(V,Cosh2A,T1);
   mul_mZ(T1,U_T,Cosh2A); 
   pE_mZ(Cosh2A, S12,P4, S8,P4, C3);

   printf(" cosh(A)**2 + sin(A)**2  :");
   X_CoshAP2_pls_SinAP2_mZ(X,CoshAP2_pls_SinAP2);
   
   mul_mZ(V,CoshAP2_pls_SinAP2,T1);
   mul_mZ(T1,U_T,CoshAP2_pls_SinAP2); 
   pE_mZ(CoshAP2_pls_SinAP2, S12,P4, S8,P4, C3);
                
   f_mZ(A);
   f_mZ(A_T);
   
   f_mZ(V);
   f_mZ(V_T);
   
   f_mZ(U);
   f_mZ(U_T);
   f_mZ(U_TA);
   f_mZ(X);
   
   f_mZ(Cosh2A);
   f_mZ(CoshAP2_pls_SinAP2);     
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun();
    
} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
  Nous avons vu que :
  
  cosh(x+y) = cosh(x) cosh(y) + sinh(x) sinh(y)
  
  posons x = y 
          
  cosh(x+x) = cosh(x) cosh(x) + sinh(x) sinh(x)  

   cosh(2x) = cosh(x)**2 + sinh(x)**2 
Exemple de sortie écran :
 A :
  +0.0088 +0.0087i   +0.0089 -0.0069i   +0.0039 -0.0077i 
  +0.0032 +0.0009i   +0.0071 -0.0088i   +0.0071 -0.0056i 
  -0.0074 -0.0028i   +0.0046 +0.0054i   -0.0089 -0.0062i 

 U :
  -0.7517 -0.1144i   +0.2786 -0.0609i   -0.2315 +0.5357i 
  -0.5776 -0.0263i   +0.1248 +0.1401i   +0.3155 -0.7287i 
  +0.2960 -0.0000i   +0.9399 +0.0000i   +0.1700 +0.0000i 

 V :
  +0.1730 -0.5441i   +0.1834 +0.2568i   -0.7342 +0.1883i 
  +0.6342 +0.1712i   -0.3704 -0.3273i   -0.0387 +0.5680i 
  +0.4925 +0.0000i   +0.8100 +0.0000i   +0.3183 +0.0000i 

 X = U_T * A * V :
  -0.0175 +0.0159i   -0.0000 -0.0000i   -0.0000 +0.0000i 
  -0.0000 -0.0000i   -0.0083 -0.0116i   +0.0000 -0.0000i 
  -0.0000 +0.0000i   -0.0000 +0.0000i   -0.0007 +0.0064i 

 Press return to continue. 


 cosh(2 A)        :
 +2.3893e-01+8.6128e-01i  -3.9521e-01-1.5026e-01i  +9.8423e-02+1.1227e-01i 
 -2.6641e-01-2.8006e-01i  -8.8912e-01+8.0224e-02i  -1.6672e-01-1.6066e-01i 
 -2.1819e-01-6.4355e-02i  -8.2888e-02+1.3176e-01i  +9.6119e-01+1.3016e-04i 

 cosh(A)**2 + sin(A)**2  :
 +2.3893e-01+8.6128e-01i  -3.9521e-01-1.5026e-01i  +9.8423e-02+1.1227e-01i 
 -2.6641e-01-2.8006e-01i  -8.8912e-01+8.0224e-02i  -1.6672e-01-1.6066e-01i 
 -2.1819e-01-6.4355e-02i  -8.2888e-02+1.3176e-01i  +9.6119e-01+1.3018e-04i 


 Press   return to continue
 Press X return to stop