Aller au contenu

Mathc complexes/08z

Un livre de Wikilivres.


Application

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

c00e.c
/* ------------------------------------ */
/*  Save as :   c00e.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */  
#define   RAb R3
#define   CA  C4
#define   Cb  C1
#define   Rv  C4
/* ------------------------------------ */
# define FREEV C1
/* ------------------------------------ */
int main(void)
{
double ab[RAb*(CA+Cb)]={ 
+4, +3, -1, -2,  -0,  /* V1|0  See c00a.c */ 
-1, -1, +2, -3,  -0,  /* V2|0             */
-2, -5, +4, -3,  -0   /* V3|0             */        
};

double Projp[Rv*C1] ={
   -12.06250000, 
   -13.75000000, 
   +15.37500000, 
   -15.75000000   
};

double **Ab      = ca_A_mRZ(ab,i_Abr_Ac_bc_mZ(RAb, CA, Cb));
double **Ab_free =             i_Abr_Ac_bc_mZ(CA,  CA, Cb + FREEV);
double **b_free  =                       i_mZ(CA,      Cb + FREEV); 

double **A       =    c_Ab_A_mZ(Ab,      i_mZ(RAb, CA));  
double **At      = transpose_mZ(A,       i_mZ(CA, RAb));
 
double **vPp     =     ca_A_mRZ(Projp,   i_mZ(Rv,C1)); 
  
double **v1      =       c_c_mZ(At,(C1), i_mZ(Rv,C1),C1); 
double **v2      =       c_c_mZ(At,(C2), i_mZ(Rv,C1),C1);
double **v3      =       c_c_mZ(At,(C3), i_mZ(Rv,C1),C1);

double **vQ      =                       i_mZ(Rv,C1);


/*  Compute the free variables (b_free) */
      gj_PP_mZ(Ab);     
  put_zeroR_mZ(Ab,Ab_free);                     
  put_freeV_mZ(Ab_free);   
         gj_mZ(Ab_free);    
     c_Ab_b_mZ(Ab_free,b_free);  

        c_c_mZ(b_free,C2, vQ,C1);
             
/* vQ is the free vector of the system Ab:
  
                  v1|0
           A|b =  v2|0
                  v3|0  
                  
   vQ is orthogonal to the vectors v1,v2 and v3 */ 
          
  clrscrn();
  printf(" Compute the orthogonal vectors to:         (See c00a .c)\n\n" 
         " v1:");      
  p_mRZ(v1, S10,P4, C1);       
  printf(" v2:");      
  p_mRZ(v2, S10,P4, C1);
  printf(" v3:");      
  p_mRZ(v3, S10,P4, C1);  
  stop();

  clrscrn();
  printf(" vQ is orthogonal to the vectors v1,v2 and v3.\n\n"
         " The equation of a hyperplan defined by v1, v2 and v3\n"
         " is ax + by + cz + dt=0, where a,b,c,d are the coordinates\n"
         " of the vector orthogonal (vQ).\n\n"
         " vQ:");       
  p_mRZ(vQ, S10,P12, C1);                     
  stop();

  clrscrn();
  printf(" vPp is the projection of a point P onto the hyperplan (See c00d.c)\n\n"
         " vPp:");   
  p_mRZ(vPp, S10,P12, C1);   
  printf(" vQ is orthogonal to the hyperplan defined by the vectors v1,v2 and v3.\n\n"
         " vQ:");   
  p_mRZ(vQ, S10,P12, C1);  
  printf(" dot(vPp,vQ)  = ");p_Z(dot_Z(vPp,vQ), S4,P5, S5,P5);    
  printf("\n The dot product of vQ and vPp say that the vector vPp\n"
         " is orthogonal to the vector vQ. Then the point p is in\n"
         " the hyperplan v1, v2 and v3.\n\n");    
  stop();  
  
  f_mZ(Ab);
  f_mZ(Ab_free);
  f_mZ(b_free);
  f_mZ(v1);          
  f_mZ(v2);
  f_mZ(vQ);
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vérifiez si la projection d'un point P appartient à l'hyperplan. Si la projection du point P, le vecteur vPp, est perpendiculaire au vecteur vQ, alors le produit scalaire de ces deux vecteurs est nul et le point Pp appartient bien à l'hyperplan.

Exemple de sortie écran :

 Compute the orthogonal vectors to:         (See c00a .c)

 v1:
   +4.0000 
   +3.0000 
   -1.0000 
   -2.0000 

 v2:
   -1.0000 
   -1.0000 
   +2.0000 
   -3.0000 

 v3:
   -2.0000 
   -5.0000 
   +4.0000 
   -3.0000 

 Press return to continue. 


 vQ is orthogonal to the vectors v1,v2 and v3.

 The equation of a hyperplan defined by v1, v2 and v3
 is ax + by + cz + dt=0, where a,b,c,d are the coordinates
 of the vector orthogonal (vQ).

 vQ:
+0.285714285714 
+1.000000000000 
+2.142857142857 
+1.000000000000 

 Press return to continue. 


 vPp is the projection of a point P onto the hyperplan (See c00d.c)

 vPp:
-12.062500000000 
-13.750000000000 
+15.375000000000 
-15.750000000000 

 vQ is orthogonal to the hyperplan defined by the vectors v1,v2 and v3.

 vQ:
+0.285714285714 
+1.000000000000 
+2.142857142857 
+1.000000000000 

 dot(vPp,vQ)  = -0.00000+0.00000i 
 The dot product of vQ and vPp say that the vector vPp
 is orthogonal to the vector vQ. Then the point p is in
 the hyperplan v1, v2 and v3.

 Press return to continue.