Application


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


c00h.c
/* ------------------------------------ */
/*  Save as :   c00h.c                  */
/* ------------------------------------ */
#include      "v_a.h"
/* ------------------------------------ */
void fun(void)
{
double u[R2*C1]={ 1,
                  1};
double v[R2*C1]={ 3,
                  2};                  
              
double **U = ca_A_mR(u,i_mR(R2,C1));
double **V = ca_A_mR(v,i_mR(R2,C1));

  clrscrn();
  printf(" Cosine of the Angle Between Vectors U and V :\n\n"); 
  
  printf(" U :");
  p_mR(U,S3,P0,C6);
  printf(" V :");
  p_mR(V,S3,P0,C6);
 
  printf(" <U,V> = %.0f \n\n", dot_R(U,V));

  printf(" ||U|| = %.4f \n\n", norm_R(U));
  printf(" ||V|| = %.4f \n\n", norm_R(V));
  
  printf(" cos(alpha) = %.4f \n\n", 
  
                    dot_R(U,V)
                          / 
             ( norm_R(U) * norm_R(V) ));  
  
  f_mR(U);
  f_mR(V);
}
/* ------------------------------------ */
int main(void)
{

  fun();
  
  stop();

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


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

 U :
 +1 
 +1 

 V :
 +3 
 +2 

 <U,V> = 5 

 ||U|| = 1.4142 

 ||V|| = 3.6056 

 cos(alpha) = 0.9806 

 Press return to continue.