Mathc matrices/c20d
Installer et compiler ces fichiers dans votre répertoire de travail.
c02b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_diag.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = rpdiag_mR( i_mR(r,r ), 9.);
double **u = r_mR( i_mR(r,C1), 9.);
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" u :");
p_mR(u,S3,P0,C6);
printf(" <u,u> = ||u||^2 (u^t*A^t*A*u)\n\n");
printf(" (<u,u>)^(1/2) = %.3f \n",
pow(dot_Diag_R(A,u,u),(1./2.)));
printf(" ||u|| = %.3f \n\n",
norm_Diag_R(A,u));
f_mR(A);
f_mR(u);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous calculons la norm d'un vecteur.
Exemple de sortie écran :
------------------------------------
A :
+8 +0 +0 +0 +0
+0 +4 +0 +0 +0
+0 +0 +1 +0 +0
+0 +0 +0 +9 +0
+0 +0 +0 +0 +8
u :
+2
-2
-6
+3
+9
<u,u> = ||u||^2 (u^t*A^t*A*u)
(<u,u>)^(1/2) = 28.513
||u|| = 28.513
Press return to continue
Press X to stop