Mathc matrices/03c
Apparence
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]={
+1,+2,
+2,+1};
double R = 3;
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);
if(T2[R1][C1]<0)
printf(" - x^2/%.3f + y^2/%.3f = 1 \n\n",
sqrt( pow( R/T2[R1][C1],2)), sqrt( pow(R/T2[R2][C2],2)));
else
printf(" x^2/%.3f - y^2/%.3f = 1 \n\n",
sqrt( pow(R/T2[R1][C1],2)), sqrt( pow(R/T2[R2][C2],2)));
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 négatif, alors l'équation de la courbe est une hyperbole.
Exemple de sortie écran :
If +1x^2 +1y^2 +4xy = +3
Can you give a description of the curve in the plan?
A:
+1.0000 +2.0000
+2.0000 +1.0000
EigsVector:
+0.7071 -0.7071
+0.7071 +0.7071
EigsValue : T_EigsVector * A * EigsVector
+3.0000 +0.0000
+0.0000 -1.0000
x^2/1.000 - y^2/3.000 = 1
Press return to continue.