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[R4*C3] = {0, 1,-2,     
                     1, 3, 1,     
                     2,-1, 0,     
                     3, 1,-1 };

double **Ap =       ca_A_mR(p,  i_mR(R4,C3));
double **A  = m_Sphere_A_mR(Ap, i_mR(R5,C5));

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(" The equation of a sphere,\n");  
  printf(" With the values of the four points:\n\n");
  printf(" c1(x^2 +y^2 +z^2)  +c2x  +c3y  +c4z  +c5 = 0\n\n");
  
  for(r=R1;r<Ap[R_SIZE][C0];r++)
  
      printf(" c1(x%d^2+y%d^2+z%d^2)"
             " +c2x%d +c3y%d +c4z%d +c5 = 0\n",r,r,r,r,r,r);      
  stop();
  
  clrscrn();  
  printf(" The four 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 Determinant:(cofactor expansion along the first row)\n\n");  
  printf("  x^2+y^2+z^2  x       y       z       1");
  p_Det_mR(A,8,0);
  
  printf(" The equation of the sphere : \n\n");  
  printf(" %+.0f(x^2+y^2+Z^2) %+.0fx %+.0fy %+.0fz %+.0f = 0\n\n",
           cofactor_R(A,R1,C1),
           cofactor_R(A,R1,C2),
           cofactor_R(A,R1,C3),
           cofactor_R(A,R1,C4),
           cofactor_R(A,R1,C5));

  printf(" Verify the result : \n\n");      
       
  for(r=R1;r<Ap[R_SIZE][C0];r++)
  
      verify_eq_sphere_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.

 The equation of a sphere,
 With the values of the four points:

 c1(x^2 +y^2 +z^2)  +c2x  +c3y  +c4z  +c5 = 0

 c1(x1^2+y1^2+z1^2) +c2x1 +c3y1 +c4z1 +c5 = 0
 c1(x2^2+y2^2+z2^2) +c2x2 +c3y2 +c4z2 +c5 = 0
 c1(x3^2+y3^2+z3^2) +c2x3 +c3y3 +c4z3 +c5 = 0
 c1(x4^2+y4^2+z4^2) +c2x4 +c3y4 +c4z4 +c5 = 0
 Press return to continue. 



 The four points:

 P1(+0,+1,-2) P2(+1,+3,+1) P3(+2,-1,+0) P4(+3,+1,-1)

 Determinant:(cofactor expansion along the first row)

  x^2+y^2+z^2  x       y       z       1
      +5      +0      +1      -2      +1
     +11      +1      +3      +1      +1
      +5      +2      -1      +0      +1
     +11      +3      +1      -1      +1

 The equation of the sphere : 

 -24(x^2+y^2+Z^2) +48x +48y +0z +72 = 0

 Verify the result : 

 With x= +0.0 y= +1.0 z= -2.0 eq=-0.00000
 With x= +1.0 y= +3.0 z= +1.0 eq=-0.00000
 With x= +2.0 y= -1.0 z= +0.0 eq=-0.00000
 With x= +3.0 y= +1.0 z= -1.0 eq=-0.00000
 Press return to continue.