Mathc matrices/c25c2
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*C2] ={ -5, 1,
3,-3,
9, 9 };
double **Ap = ca_A_mR(p, i_mR(R3,C2));
double **A = m_parabola_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 parabola: \n\n");
printf(" c1 y + c2 x^2 + c3 x + 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(" c1y%d + c2x%d^2 + c3x%d + c4 = 0\n",
r,r,r);
printf("\n The four equation:\n\n");
printf(" c1y + c2x^2 + c3x + c4 = 0\n");
for(r=R1;r<Ap[R_SIZE][C0];r++)
printf(" c1y%d + c2x%d^2 + c3x%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)",r,Ap[r][C1],Ap[r][C2]);
printf(" The determinant :\n\n (cofactor expansion along the first row)\n\n");
printf(" y x^2 x 1");
p_Det_mR(A,6,0);
printf(" The equation of the parabola : \n\n");
printf(" %+.0f y %+.0f x^2 %+.0f x %+.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_parabola_mR(A, Ap[r][C1],
Ap[r][C2]);
stop();
f_mR(Ap);
f_mR(A);
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 parabola:
c1 y + c2 x^2 + c3 x + c4 = 0
The same equation with the values of the three points:
c1y1 + c2x1^2 + c3x1 + c4 = 0
c1y2 + c2x2^2 + c3x2 + c4 = 0
c1y3 + c2x3^2 + c3x3 + c4 = 0
The four equation:
c1y + c2x^2 + c3x + c4 = 0
c1y1 + c2x1^2 + c3x1 + c4 = 0
c1y2 + c2x2^2 + c3x2 + c4 = 0
c1y3 + c2x3^2 + c3x3 + c4 = 0
Press return to continue.
The three points:
P1(-5,+1) P2(+3,-3) P3(+9,+9) The determinant :
(cofactor expansion along the first row)
y x^2 x 1
+1 +25 -5 +1
-3 +9 +3 +1
+9 +81 +9 +1
The equation of the parabola :
-672 y +120 x^2 -96 x -2808 = 0
Verify the result :
With x= -5.0 y= +1.0 eq=+0.00000
With x= +3.0 y= -3.0 eq=+0.00000
With x= +9.0 y= +9.0 eq=+0.00000
Press return to continue.