Mathc matrices/039
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA R2
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+2,-2,
-2,+5};;
double R = 6;
double Ev1Ev2 = 0;
double **A = ca_A_mR(a,i_mR(RCA,RCA));
double **EigsVector = i_mR(RCA,RCA);
double **T_EigsVector = i_mR(RCA,RCA);
double **T1 = i_mR(RCA,RCA);
double **T2 = i_mR(RCA,RCA);
clrscrn();
printf(" If %+.0fx^2 %+.0fy^2 %+.0fxy = %+.0f \n\n"
" Can you give a description of the curve in the plan?\n\n",
A[R1][C1], A[R2][C2], 2*(A[R1][C2]), R);
printf(" A:");
p_mR(A,S10,P4,C6);
printf(" EigsVector:");
eigs_V_mR(A,EigsVector);
p_mR(EigsVector,S10,P4,C6);
printf(" EigsValue : T_EigsVector * A * EigsVector");
transpose_mR(EigsVector,T_EigsVector);
mul_mR(T_EigsVector,A,T1);
mul_mR(T1,EigsVector,T2);
p_mR(T2,S10,P4,C6);
Ev1Ev2 = (T2[R1][C1])*(T2[R2][C2]);
if(Ev1Ev2 > 0)
printf(" The product of the eign values = %+.3f > 0"
" give an ellipse or a circle.\n\n\n",
Ev1Ev2);
else
printf(" The product of the eign values = %+.3f < 0"
" give an hyperbola.\n\n\n",
Ev1Ev2);
printf(" %+.3f x^2 %+.3f y^2 = %+.3f \n\n",
T2[R1][C1], T2[R2][C2], R);
stop();
f_mR(A);
f_mR(EigsVector);
f_mR(T_EigsVector);
f_mR(T1);
f_mR(T2);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Matrice symétrique: Si le produit des valeurs propres est positif, alors l'équation de la courbe est un cercle ou une ellipse.
Exemple de sortie écran :
If +2x^2 +5y^2 -4xy = +6
Can you give a description of the curve in the plan?
A:
+2.0000 -2.0000
-2.0000 +5.0000
EigsVector:
-0.4472 +0.8944
+0.8944 +0.4472
EigsValue : T_EigsVector * A * EigsVector
+6.0000 +0.0000
+0.0000 +1.0000
The product of the eign values = +6.000 > 0 give an ellipse or a circle.
+6.000 x^2 +1.000 y^2 = +6.000
Press return to continue.