Application


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


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

double **projuv      = i_mR(r,C1);
double **umnsprojuv  =  i_mR(r,C1);

  clrscrn();
  printf(" A :");
  p_mR(A,S3,P0,C6);
  printf(" u :");
  p_mR(u,S3,P0,C6);
  printf(" v :");
  p_mR(v,S3,P0,C6);

  proj_Diag_mR(A,u,v,projuv);
  printf(" vector component of u along v \n\n");  
  printf(" projuv :");
  p_mR(projuv,S3,P4,C6);
  stop();
  
  clrscrn();
  printf(" vector component of u orthogonal to v \n\n");
  printf(" u-projuv :");
  sub_mR(u,projuv,umnsprojuv);
  p_mR(umnsprojuv,S3,P4,C6);
  printf(" <v, u-projuv> = %.12f \n\n", dot_Diag_R(A,v,umnsprojuv));
  
  f_mR(A);
  f_mR(u);
  f_mR(v);
  f_mR(projuv);
  f_mR(umnsprojuv);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(R3);

} while(stop_w());

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


On vérifie une propriétée.


Exemple de sortie écran :
 ------------------------------------ 
 A :
 +1  +0  +0 
 +0  +1  +0 
 +0  +0  +4 

 u :
 +7 
 -9 
 +1 

 v :
 -5 
 -4 
 -9 

 vector component of u along v 

 projuv :
+0.4795 
+0.3836 
+0.8630 

 Press return to continue. 


 ------------------------------------ 
 vector component of u orthogonal to v 

 u-projuv :
+6.5205 
-9.3836 
+0.1370 

 <v, u-projuv> = -0.000000000000 


 Press return to continue
 Press X      to stop