Linear Algebra and the C Language/a0a3
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **u = r_mR(i_mR(r,C1),9.);
clrscrn();
printf(" u :");
p_mR(u,S3,P0,C6);
printf(" <u,u> = ||u||^2 \n\n");
printf(" (<u,u>)^(1/2) = %.3f \n",
pow(dot_R(u,u),(1./2.)));
printf(" ||u|| = %.3f \n\n",
norm_R(u));
f_mR(u);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
u :
+1
-3
-3
+9
-4
<u,u> = ||u||^2
(<u,u>)^(1/2) = 10.770
||u|| = 10.770
Press return to continue
Press X return to stop