Aller au contenu

Mathc matrices/05i

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    RC5
/* ------------------------------------ */
#define    EV    R1  
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+0.329527604306, -0.365886364507, -0.067047239569, +0.001915635416, -0.287345312440, 
-0.365886364507, +0.800330583940, -0.036588636451, +0.001045389613, -0.156808441932, 
-0.067047239569, -0.036588636451, +0.993295276043, +0.000191563542, -0.028734531244, 
+0.001915635416, +0.001045389613, +0.000191563542, +0.999994526756, +0.000820986607, 
-0.287345312440, -0.156808441932, -0.028734531244, +0.000820986607, +0.876852008954                    
};

double evalue[RCA*C1]={
+1,  
+1,
+1,
+1,
+0  
};

double **A        = ca_A_mR(a,      i_mR(RCA,RCA));
double **EValue   = ca_A_mR(evalue, i_mR(RCA,C1));

double **Ide      =  eye_mR(   i_mR(RCA,RCA));
double **sIde     =            i_mR(RCA,RCA);
double **AmnssIde =            i_mR(RCA,RCA);

double **Ab       =            i_Abr_Ac_bc_mR(RCA,RCA,C1);
double **b        =            i_mR(RCA,C1);
double **Ab_free  =            i_Abr_Ac_bc_mR(RCA,RCA,RCA);
double **b_free   =            i_mR(RCA,RCA);

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

  clrscrn();
  printf(" A :");
  p_mR(A,S10,P5,C10);
  
         smul_mR(EValue[EV][C1],Ide,sIde);          
        MmnsD_mR(A,sIde,AmnssIde);
        
     c_A_b_Ab_mR(AmnssIde,b,Ab); 
        gj_PP_mR(Ab,NO);  
// Ab : You can find the equation of the plan when the eigenvalues equal 1 (EV=R1)
    put_zeroR_mR(Ab,Ab_free);
    put_freeV_mR(Ab_free); 
        gj_PP_mR(Ab_free,YES);      
       c_Ab_b_mR(Ab_free,b_free);

          c_c_mR(b_free,C2,V,EV);  
          c_c_mR(b_free,C3,V,EV+C1);
          c_c_mR(b_free,C4,V,EV+C2);
          c_c_mR(b_free,C5,V,EV+C3);
                                                  
    Normalize_mR(V);
           
          printf(" V%d : Copy V%d into the last file",EV,EV);
          P_mR(V,S10,P12,C10); 
           
  stop();
             
  f_mR(A);
  f_mR(EValue);
  
  f_mR(Ide);
  f_mR(sIde);
  f_mR(AmnssIde);
  
  f_mR(Ab);
  f_mR(b);
  f_mR(Ab_free);    
  f_mR(b_free);
  
  f_mR(V); 
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Projection de l'hyperespace sur un hyperplan 
* Calculer un vecteur propre : 
* #define    EV    R1  pour calculer V1, V2, V3 et V4
* #define    EV    R5  pour calculer V5


Exemple de sortie écran :

 A :
  +0.32953   -0.36589   -0.06705   +0.00192   -0.28735 
  -0.36589   +0.80033   -0.03659   +0.00105   -0.15681 
  -0.06705   -0.03659   +0.99330   +0.00019   -0.02873 
  +0.00192   +0.00105   +0.00019   +0.99999   +0.00082 
  -0.28735   -0.15681   -0.02873   +0.00082   +0.87685 

 V1 : Copy V1 into the last file
-0.479027840775, -0.099503719020, +0.002857131195, -0.393919298579,       -nan, 
+0.877799708227, +0.000000000000, +0.000000000000, +0.000000000000,       -nan, 
+0.000000000000, +0.995037190210, +0.000000000000, +0.000000000000,       -nan, 
+0.000000000000, +0.000000000000, +0.999995918392, +0.000000000000,       -nan, 
+0.000000000000, +0.000000000000, +0.000000000000, +0.919145030018,       -na , 

 Press return to continue.