Linear Algebra and the C Language/a0jk
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(void)
{
double s = r_I(9);
double **U_T = r_mR( i_mR(R1,C3), 9);
double **V_T = smul_mR(s,U_T, i_mR(R1,C3));
double **UxV_T = UxV_mR(U_T,V_T, i_mR(R1,C3));
clrscrn();
printf(" s = %+.0f\n\n",s);
printf(" u_T:");
p_mR(U_T, S4, P0, C6);
printf(" v_T:");
p_mR(V_T, S4, P0, C6);
printf("\n\n"
" If u and v are colinear then u x v == 0\n\n"
" (uxv):" );
p_mR(UxV_T, S5, P0, C6);
f_mR(U_T);
f_mR(V_T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
If u and v are colinear then u x v == 0:
Screen output example:
s = -3
u_T :
+8 +7 +7
v_T :
-24 -21 -21
If u and v are colinear then u x v == 0
(uxv) :
+0 -0 +0
Press return to continue
Press X return to stop