Mathc matrices/c25e1
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c01.c */
int main(void)
double p[R4*C3] ={ 1, 2, 3, 
 -1, 2, 1, 
 1, 0, 1, 
 1, 2, -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(+1,+2,+3) P2(-1,+2,+1) P3(+1,+0,+1) P4(+1,+2,-1)
 Determinant:(cofactor expansion along the first row)
 x^2+y^2+z^2 x y z 1
 +14 +1 +2 +3 +1
 +6 -1 +2 +1 +1
 +2 +1 +0 +1 +1
 +6 +1 +2 -1 +1
 The equation of the sphere : 
 +16(x^2+y^2+Z^2) -32x -64y -32z +32 = 0
 Verify the result : 
 With x= +1.0 y= +2.0 z= +3.0 eq=+0.00000
 With x= -1.0 y= +2.0 z= +1.0 eq=+0.00000
 With x= +1.0 y= +0.0 z= +1.0 eq=+0.00000
 With x= +1.0 y= +2.0 z= -1.0 eq=+0.00000
 Press return to continue.

Mathc matrices/c25e2
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c02.c */
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.

Mathc matrices/h25e
Application
Installer ce fichier dans votre répertoire de travail.
/* Save as : d.h */
void verify_eq_sphere_mR(
double **A,
double x,
double y,
double z
double p = cofactor_R(A,R1,C1)*(pow(x,2)+pow(y,2)+pow(z,2))
 + cofactor_R(A,R1,C2)*(x)
 + cofactor_R(A,R1,C3)*(y)
 + cofactor_R(A,R1,C4)*(z)
 + cofactor_R(A,R1,C5);
 printf(" With x=%+5.1f y=%+5.1f z=%+5.1f eq=%+5.5f\n",
 x,y,z,p); 
/* ------------------------------------ */ 
void p_Det_mR(
double **A,
int e,
int d
 int r;
 int c;
 for(r=R2;r<A[R_SIZE][C0];r++)
 printf("\n");
 for (c=C1;c<A[C_SIZE][C0];c++)
 printf("%+*.*f",e,d,A[r][c]);
 printf("\n\n");
/* ------------------------------------ */
double ** m_Sphere_A_mR(
double **At,
double **A
int ra;
int r;
int c;
int ct;
 for(c=C1;c<A[C_SIZE][C0];c++)A[R1][c]=1.; /* First line */
 for(r=R2,ra=R1; r<A[R_SIZE][C0]; r++,ra++)
 c=C1; 
 for(ct=C1;ct<At[C_SIZE][C0];ct++)
 A[r][c]+=pow(At[ra][ct],2); /* x^2+y^2+z^2 */
 c++; A[r][c]= At[ra][C1]; /* x^1 */
 c++; A[r][c]= At[ra][C2]; /* y^1 */
 c++; A[r][c]= At[ra][C3]; /* z^1 */
 c++; A[r][c]= 1.; /* x^0*y^0*z^0 */

return(A);
/* --------------------------------- */
 Déclaration des fichiers h.

Mathc matrices/a26
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c00b.c */
void fun(void)
double a[R4*C4]={ 1, 1,1,1,
 0, 1,9,9,
 0,-3,9,9,
 0,-4,9,9 }; 
double id[R4*C4]={ 1, 0,0,0,
 0, 1,0,0,
 0, 3,1,0,
 0, 4,0,1 }; 
double **A = ca_A_mR(a, i_mR(R4,C4));
double **ID = ca_A_mR(id,i_mR(R4,C4));
double **IDA = mul_mR(ID,A,i_mR(R4,C4));
 clrscrn();
 printf(" Zero under the pivot \n\n");
 printf(" ID :");
 p_mR(ID,S3,P0,C6);
 printf(" A :");
 p_mR(A,S3,P0,C6);
 printf(" ID A : Add a constant c times one row to another.");
 p_mR(IDA,S5,P1,C6);
 f_mR(A);
 f_mR(ID);
 f_mR(IDA);
/* ------------------------------------ */
int main(void)
 fun();
 stop();
 return 0;
/* ------------------------------------ */
Mettre des zéros sous le pivot :
Exemple de sortie écran :
 Zero under the pivot 
 ID :
 +1 +0 +0 +0 
 +0 +1 +0 +0 
 +0 +3 +1 +0 
 +0 +4 +0 +1 
 A :
 +1 +1 +1 +1 
 +0 +1 +9 +9 
 +0 -3 +9 +9 
 +0 -4 +9 +9 
 ID A : Add a constant c times one row to another.
 +1.0 +1.0 +1.0 +1.0 
 +0.0 +1.0 +9.0 +9.0 
 +0.0 +0.0 +36.0 +36.0 
 +0.0 +0.0 +45.0 +45.0 
 Press return to continue.