Fonctions de bases


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

c05e.c
/* ------------------------------------ */
/*  Save as :   c05e.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **u  = r_mR(i_mR(r,C1),9.);
double **v  = r_mR(i_mR(r,C1),9.);

  clrscrn();
  printf("      <u,v>  =  ||u|| ||v|| cos(a)  =  u1 v1 + u2 v2 + u3 v3 \n");
  printf(" u :");
  p_mR(u,S3,P0,C6);
  printf(" v :");
  p_mR(v,S3,P0,C6);
  
  printf(" <u,v> = v^t u \t      <v,u> = u^t v\n");
  printf(" <u,v> = %+.0f  \t      <v,u> = %+.0f\n\n\n", 
                dot_R(u,v), dot_R(v,u));
                
  printf(
  " if   <u,v> = 0 : u and v are orthogonal\n"
  " if   <u,v> > 0 : u and v form the shape of an acute  angle   (< )\n"
  " if   <u,v> < 0 : u and v form the shape of an obtuse angle  (\\_)\n\n"
        );
    
  f_mR(u);
  f_mR(v);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(R3);

} while(stop_w());

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


Nous voyons le produit scalaire : dot_R(u,v);



Exemple de sortie écran :
 -----------------------
      <u,v>  =  ||u|| ||v|| cos(a)  =  u1 v1 + u2 v2 + u3 v3 
 u :
 +5 
 -4 
 +3 

 v :
 +4 
 -3 
 -8 

 <u,v> = v^t u 	      <v,u> = u^t v
 <u,v> = +8  	      <v,u> = +8


 if   <u,v> = 0 : u and v are orthogonal
 if   <u,v> > 0 : u and v form the shape of an acute  angle   (< )
 if   <u,v> < 0 : u and v form the shape of an obtuse angle  (\_)


 Press   return to continue
 Press X return to stop