Mathc matrices/c20z
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00h.c |
---|
/* ------------------------------------ */
/* Save as : c00h.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_trac.h"
/* ------------------------------------ */
void fun(void)
{
double a[R2*C2]={ 1,2,
3,4};
double b[R2*C2]={-1,0,
3,2};
double **A = ca_A_mR(a,i_mR(R2,C2));
double **B = ca_A_mR(b,i_mR(R2,C2));
clrscrn();
printf(" Cosine of the Angle Between Vectors in M_2x2 :\n\n");
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" B :");
p_mR(B,S3,P0,C6);
printf(" <A,B> = %.0f \n\n", dot_TR_R(A,B));
printf(" ||A|| = %.4f = %.4f\n\n", norm_TR_R(A),sqrt(30));
printf(" ||B|| = %.4f = %.4f\n\n", norm_TR_R(B),sqrt(14));
printf(" cos(alpha) = %.4f \n\n",
dot_TR_R(A,B)
/
(norm_TR_R(A)*norm_TR_R(B)));
f_mR(A);
f_mR(B);
}
/* ------------------------------------ */
int main(void)
{
fun();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
------------------------------------
Cosine of the Angle Between Vectors in M_2x2 :
A :
+1 +2
+3 +4
B :
-1 +0
+3 +2
<A,B> = 16
||A|| = 5.4772 = 5.4772
||B|| = 3.7417 = 3.7417
cos(alpha) = 0.7807
Press return to continue
Press X to stop