Application


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


c05a.c
/* ------------------------------------ */
/*  Save as :   c05a.c                  */
/* ------------------------------------ */
#include      "w_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define   RCQ RC3
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **u      = r_mZ(i_mZ(RCQ,C1) ,9.);
double **v      = r_mZ(i_mZ(RCQ,C1) ,9.);

double **Q      = r_Q_mZ(i_mZ(RCQ,RCQ), 9);              

double **Qu      = mul_mZ(Q,u,i_mZ(RCQ,C1));
double **Qv      = mul_mZ(Q,v,i_mZ(RCQ,C1));              

  clrscrn();
  printf(" Cosine of the Angle Between Vectors U and V :\n\n"); 
  
  printf(" u :");
  p_mZ(u,S3,P0,S3,P4,C6);
  printf(" v :");
  p_mZ(v,S3,P0,S3,P4,C6);
  
  printf("                 <u,v>    \n"
         " cos(alpha) = ----------- = ");
  p_Z(smul_Z(1./(norm_Z(u)*norm_Z(v)),  
             dot_Z(u,v)),S3,P4, S3,P4);        
  printf("\n              ||u|| ||v||     \n\n\n"); 
          
                                    
  stop();

  clrscrn();
  printf(" Q :");
  p_mZ(Q,S3,P4,S3,P4,C6);  
  stop();
  
  clrscrn();
  printf(" Cosine of the Angle Between Vectors U and V :\n\n"); 
  
  printf(" Qu :");
  p_mZ(Qu,S3,P4,S3,P4,C6);
  printf(" Qv :");
  p_mZ(Qv,S3,P4,S3,P4,C6);
  
  printf("               <Qu,Qv>    \n"
         " cos(alpha) = ----------- = ");
  p_Z(smul_Z(1./(norm_Z(u)*norm_Z(v)),  
             dot_Z(Qu,Qv)),S3,P4, S3,P4);        
  printf("\n              ||u|| ||v||     \n\n\n"); 
        
  stop();  
  
  clrscrn();
  printf(" Cosine of the Angle Between Vectors U and V :\n\n");   
  printf("                 <u,v>    \n"
         " cos(alpha) = ----------- = ");
  p_Z(smul_Z(1./(norm_Z(u)*norm_Z(v)),  
             dot_Z(u,v)),S3,P4, S3,P4);        
  printf("\n              ||u|| ||v||     \n\n\n"); 

  printf("               <Qu,Qv>    \n"
         " cos(alpha) = ----------- = ");
  p_Z(smul_Z(1./(norm_Z(u)*norm_Z(v)),  
             dot_Z(Qu,Qv)),S3,P4, S3,P4);        
  printf("\n              ||u|| ||v||     \n\n\n"); 
  
  f_mZ(u);
  f_mZ(v);
  f_mZ(Qu);
  f_mZ(Qv);  
  f_mZ(Q);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}

/* ------------------------------------ */
/* ------------------------------------ */


Exemple de sortie écran :
 ------------------------------------ 
 Cosine of the Angle Between Vectors U and V :

 u :
 -3+9.0000i 
 -4+6.0000i 
 -2-6.0000i 

 v :
 +1-2.0000i 
 +6-3.0000i 
 +3-9.0000i 

                 <u,v>    
 cos(alpha) = ----------- = -0.0940-0.0564i 
              ||u|| ||v||     


 Press return to continue. 


 ------------------------------------ 
 Q :
-0.4925+0.4925i +0.2987-0.5508i -0.2970-0.1845i 
-0.2814+0.4222i +0.0000+0.7313i -0.3617+0.2775i 
+0.4222-0.2814i +0.2692+0.0140i -0.7908-0.2113i 

 Press return to continue. 

 ------------------------------------ 
 Cosine of the Angle Between Vectors U and V :

 Qu :
-1.3582+0.2363i 
-4.9544-5.1093i 
+0.4196+11.3698i 

 Qv :
-1.9188-0.6037i 
+4.1690+9.4604i 
-2.7574+4.6337i 

               <Qu,Qv>    
 cos(alpha) = ----------- = -0.0940-0.0564i 
              ||u|| ||v||     


 Press return to continue. 


 ------------------------------------ 
 Cosine of the Angle Between Vectors U and V :

                 <u,v>    
 cos(alpha) = ----------- = -0.0940-0.0564i 
              ||u|| ||v||     


               <Qu,Qv>    
 cos(alpha) = ----------- = -0.0940-0.0564i 
              ||u|| ||v||     



 Press   return to continue
 Press X return to stop