Aller au contenu

Mathc matrices/c25b2

Un livre de Wikilivres.


Application


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


c02.c
/* ------------------------------------ */
/*  Save as :   c02.c                   */
/* ------------------------------------ */
#include "v_a.h"
#include   "d.h"
/* --------------------------------- */
int main(void)
{
double   p[R3*C3] ={ 1,  0,  0,     
                     0,  1,  0,     
                     0,  0,  1};

double **Ap =    ca_A_mR(p,  i_mR(R3,C3));
double **A  = m_plan_A_mR(Ap, i_mR(R4,C4));

int r;

  clrscrn();
  printf(" Theorem.\n\n");
  printf(" A homogeneous linear system with as many equations\n");
  printf(" as unknowns has a nontrivial  solution if and only\n");
  printf(" if the determinant  of the  coefficient  matrix is\n");
  printf(" zero.\n\n");
  
  printf(" Equation of a plane:   \n\n");
  printf(" c1 x  + c2 y  + c3 z  + c4 = 0\n\n");    
  
  printf(" The same equation with the values of the three points:\n\n");
  
  for(r=R1;r<Ap[R_SIZE][C0];r++)
  
      printf(" c1 x%d + c2 y%d + c3 z%d + c4 = 0\n",r,r,r);      
  
  printf("\n The four equation:\n\n");
  printf(" c1 x  + c2 y  + c3 z  + c4 = 0\n");   
   
  for(r=R1;r<Ap[R_SIZE][C0];r++)
  
      printf(" c1 x%d + c2 y%d + c3 z%d + c4 = 0\n",r,r,r);   
         
  stop();
  
  clrscrn();
  printf(" The three points:\n\n");
  
  for(r=R1;r<Ap[R_SIZE][C0];r++)
  
       printf(" P%d(%+.0f,%+.0f,%+.0f)",
              r,Ap[r][C1],Ap[r][C2],Ap[r][C3]);

  printf("\n\n The determinant :\n "
         "(cofactor expansion along the first row)\n\n");
  
  printf("     x     y     z     1");
  p_Det_mR(A,6,0);
  
  printf(" The equation of the plane : \n\n");
  
  printf(" %+.0f x %+.0f y %+.0f z %+.0f = 0\n\n",
           cofactor_R(A,R1,C1),
           cofactor_R(A,R1,C2),
           cofactor_R(A,R1,C3),
           cofactor_R(A,R1,C4));
           
  printf(" Verify the result : \n\n");  
           
  for(r=R1;r<Ap[R_SIZE][C0];r++)
  
      verify_eq_plan_mR(A, Ap[r][C1],
                           Ap[r][C2],
                           Ap[r][C3]);
           
  stop();
  
  f_mR(A);
  f_mR(Ap);

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



Exemple de sortie écran :
 ------------------------------------ 

 Theorem.

 A homogeneous linear system with as many equations
 as unknowns has a nontrivial  solution if and only
 if the determinant  of the  coefficient  matrix is
 zero.

 Equation of a plane:   

 c1 x  + c2 y  + c3 z  + c4 = 0

 The same equation with the values of the three points:

 c1 x1 + c2 y1 + c3 z1 + c4 = 0
 c1 x2 + c2 y2 + c3 z2 + c4 = 0
 c1 x3 + c2 y3 + c3 z3 + c4 = 0

 The four equation:

 c1 x  + c2 y  + c3 z  + c4 = 0
 c1 x1 + c2 y1 + c3 z1 + c4 = 0
 c1 x2 + c2 y2 + c3 z2 + c4 = 0
 c1 x3 + c2 y3 + c3 z3 + c4 = 0
 Press return to continue. 

 

 The three points:

 P1(+1,+0,+0) P2(+0,+1,+0) P3(+0,+0,+1)

 The determinant :
 (cofactor expansion along the first row)

     x     y     z     1
    +1    +0    +0    +1
    +0    +1    +0    +1
    +0    +0    +1    +1

 The equation of the plane : 

 +1 x +1 y +1 z -1 = 0

 Verify the result : 

 With x=+1 y=+0 z=+0 eq=+0.00000
 With x=+0 y=+1 z=+0 eq=+0.00000
 With x=+0 y=+0 z=+1 eq=+0.00000
 Press return to continue.