Mathc matrices/c23g

Un livre de Wikilivres.


Application


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


c00g.c
/* ------------------------------------ */
/*  Save as :   c00g.c                  */
/* ------------------------------------ */
#include    "v_a.h"
#include "dot_trac.h"
/* ------------------------------------ */
void fun(int r)
{
double **A  = r_mR(i_mR(r,r),99.);
double **B  = r_mR(i_mR(r,r),99.);
double **projAB  = i_mR(r,r);
double **umnsprojAB  =  i_mR(r,r);

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

  stop();
  clrscrn();
  
  proj_TR_mR(A,B,projAB);
  
  printf(" vector component of A along B \n\n");  
  printf(" projAB :");
  p_mR(projAB,S10,P4,C6);

  stop();
  clrscrn();

  printf(" vector component of A orthogonal to B \n\n");
  printf(" A-projAB :");
  sub_mR(A,projAB,umnsprojAB);
  p_mR(umnsprojAB,S10,P4,C6);
  
  printf(" <B,A-projAB> = %.4f \n\n", dot_TR_R(B,umnsprojAB));

  f_mR(A);
  f_mR(B);
  f_mR(projAB);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
do
{
  fun(rp_I(R3)+R2);

} while(stop_w());

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


Une propriétée des produits scalaires.


Exemple de sortie écran :
 ------------------------------------ 
 A :
-33 +81 +15 
+11 +62 +44 
+85 +23 +60 

 B :
+98 -13 +87 
+38 +35 +66 
+25 +51 +37 

 Press return to continue. 

 ------------------------------------  
 vector component of A along B 

 projAB :
  +27.1647    -3.6035   +24.1156 
  +10.5333    +9.7017   +18.2946 
   +6.9298   +14.1367   +10.2561 

 Press return to continue. 

 ------------------------------------ 
 vector component of A orthogonal to B 

 A-projAB :
  -60.1647   +84.6035    -9.1156 
   +0.4667   +52.2983   +25.7054 
  +78.0702    +8.8633   +49.7439 

 <B,A-projAB> = 0.0000 


 Press return to continue
 Press X      to stop