Mathc matrices/c20j
Installer et compiler ces fichiers dans votre répertoire de travail.
c00e.c |
---|
/* ------------------------------------ */
/* Save as : c00e.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.);
double **v = r_mR(i_mR(r,C1),9.);
double **projuv = i_mR(r,C1);
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" u :");
p_mR(u,S3,P0,C6);
printf(" v :");
p_mR(v,S3,P0,C6);
stop();
clrscrn();
proj_Diag_mR(A,u,v,projuv);
printf(" vector component of u along v \n\n");
printf(" projuv :");
p_mR(projuv,S3,P4,C6);
f_mR(A);
f_mR(u);
f_mR(v);
f_mR(projuv);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
On calcule le projeté de u sur v.
Exemple de sortie écran :
------------------------------------
A :
+1 +0 +0 +0
+0 +2 +0 +0
+0 +0 +5 +0
+0 +0 +0 +8
u :
-8
-7
-5
-9
v :
+9
-8
+8
+3
Press return to continue.
------------------------------------
vector component of u along v
projuv :
-5.6306
+5.0050
-5.0050
-1.8769
Press return to continue
Press X to stop