Mathc matrices/c10f
Installer et compiler ces fichiers dans votre répertoire de travail.
c00h.c |
---|
/* ------------------------------------ */
/* Save as : c00h.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_au.h"
/* ------------------------------------ */
void fun(void)
{
double a[R2*C2]={ 9,8,
5,3};
double u[R2*C1]={ 9,
8};
double v[R2*C1]={ 7,
2};
double **A = ca_A_mR(a,i_mR(R2,C2));
double **U = ca_A_mR(u,i_mR(R2,C1));
double **V = ca_A_mR(v,i_mR(R2,C1));
clrscrn();
printf(" Cosine of the Angle Between Vectors U and V :\n\n");
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" U :");
p_mR(U,S3,P0,C6);
printf(" V :");
p_mR(V,S3,P0,C6);
printf(" <U,V> = %.0f \n\n", dot_Au_R(A,U,V));
printf(" ||U|| = %.4f \n\n", norm_Au_R(A,U));
printf(" ||V|| = %.4f \n\n", norm_Au_R(A,V));
printf(" cos(alpha) = %.4f \n\n",
dot_Au_R(A,U,V)
/
( norm_Au_R(A,U) * norm_Au_R(A,V) ));
f_mR(A);
f_mR(U);
f_mR(V);
}
/* ------------------------------------ */
int main(void)
{
fun();
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
Cosine of the Angle Between Vectors U and V :
A :
+9 +8
+5 +3
U :
+9
+8
V :
+7
+2
<U,V> = 14284
||U|| = 160.5802
||V|| = 89.0056
cos(alpha) = 0.9994
Press return to continue.