Aller au contenu

Mathc matrices/08v

Un livre de Wikilivres.


Application

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

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA          RC3  
/* ------------------------------------ */
int main(void)
{
double V1[RCA*C1] ={   
+4,  
+3, 
-1      
};

double V2[RCA*C1] ={   
-1, 
-1, 
+2   
};

double V3[RCA*C1] ={   
-3, 
-4, 
+2   
};

double **v1  = ca_A_mR(V1,               i_mR(RCA,C1));
double **Nv1 = smul_mR(1./norm_R(v1),v1, i_mR(RCA,C1));

double **v2  = ca_A_mR(V2,               i_mR(RCA,C1));
double **Nv2 = smul_mR(1./norm_R(v2),v2, i_mR(RCA,C1));

double **v3  = ca_A_mR(V3,               i_mR(RCA,C1));
double **Nv3 = smul_mR(1./norm_R(v3),v3, i_mR(RCA,C1));

double **Nvn =                           i_mR(RCA,RCA);

  clrscrn();
  printf(" You can choose the values of:\n\n"
         " v1: The first vector of the plan ");
  P_mR(v1,S3,P0,C6);                            
  printf(" Nv1 = (1/||v1||)v1");
  p_mR(Nv1,S3,P12,C6);         
     
  printf(" v2: The second vector of the plan");
  P_mR(v2,S3,P0,C6);
  printf(" Nv2 = (1/||v2||)v2");
  p_mR(Nv2,S3,P12,C6);
  stop();              

  clrscrn();
  printf(" v3: The vector for the projection");
  P_mR(v3,S3,P0,C6);
  printf(" Nv3 = (1/||v3||)v3");
  p_mR(Nv3,S3,P12,C6);  
    
  printf("\n");
  c_c_mR(Nv1,C1,Nvn,C1);
  c_c_mR(Nv2,C1,Nvn,C2); 
  c_c_mR(Nv3,C1,Nvn,C3);  
  printf(" Nvn is the matrix of the eigenvectors of the matrix A.  \n\n"
         " Copy this code into the files c00b.c and c00c.c\n\n"
         " Nv1              Nv2              Nv3:");
  P_mR(Nvn,S3,P12,C6);  
  stop();    

  f_mR(v1);
  f_mR(Nv1); 

  f_mR(v2);
  f_mR(Nv2);
  
  f_mR(v3);
  f_mR(Nv3);
  
  f_mR(Nvn); 
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vous choisissez les vecteurs du plan (V1) et (V2) et le vecteur de projection (V3). Ensuite, vous normalisez ces vecteurs et vous les copiez dans la matrice (Nvn). Vous devez copier cette matrice, (Nvn), dans les fichiers c00b.c et c00c.c 

Exemple de sortie écran :

  
 You can choose the values of:

 v1: The first vector of the plan 
 +4, 
 +3, 
 -1  

 Nv1 = (1/||v1||)v1
+0.784464540553 
+0.588348405415 
-0.196116135138 

 v2: The second vector of the plan
 -1, 
 -1, 
 +2  

 Nv2 = (1/||v2||)v2
-0.408248290464 
-0.408248290464 
+0.816496580928 

 Press return to continue. 


 v3: The vector for the projection
 -3, 
 -4, 
 +2  

 Nv3 = (1/||v3||)v3
-0.557086014531 
-0.742781352708 
+0.371390676354 


 Nvn is the matrix of the eigenvectors of the matrix A.  

 Copy this code into the files c00b.c and c00c.c

 Nv1              Nv2              Nv3:
+0.784464540553, -0.408248290464, -0.557086014531, 
+0.588348405415, -0.408248290464, -0.742781352708, 
-0.196116135138, +0.816496580928, +0.371390676354  

 Press return to continue