Mathc matrices/c12ed3
Installer et compiler ces fichiers dans votre répertoire de travail.
cq8.c |
---|
/* ------------------------------------ */
/* Save as : cq8.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RCV RC3
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **V = r_Q_mR( i_mR(RCV,RCV), 9);
double **v[RCV];
double **x = r_mR(i_mR(RCV,C1),9.);
int c;
/* ------------------------------------ */
/* ------------------------------------ */
for(c=C0; c<csize_R(V); c++)
{
v[c] = i_mR(RCV,C1);
c_c_mR(V,(c+C1),v[c],C1); }
/* ------------------------------------ */
/* ------------------------------------ */
clrscrn();
printf(" V : orthonormal matrix");
p_mR(V,S10,P4,C7);
printf(" x : in the standard basis");
p_mR(x,S10,P4,C6);
printf(" v[0] v[1] ... v[n]\n");
p_mR(V,S10,P4,C7);
printf(" Compute x in the V basis : \n\n"
" x =");
for(c=C0; c<csize_R(V); c++)
printf(" <x,v[%d]>*v[%d] + ",c,c);
printf("\b\b \n\n");
printf(" x =");
for(c=C0; c<csize_R(V); c++)
printf(" %+.4f*v[%d]",dot_R(x,v[c]),c);
printf("\n");
/* ------------------------------------ */
/* ------------------------------------ */
for(c=C0; c<csize_R(V); c++)
f_mR(v[c]);
/* ------------------------------------ */
/* ------------------------------------ */
f_mR(x);
f_mR(V);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Calculer x dans la base orthonormale V : x_V = [c0,c1,c2] avec x = c0*v[0] + c1*v[1] + c2*v[2]
Remarque : x = c0*v[0] + c1*v[1] + c2 v[2] <x,v[0]> = <c0*v[0],v[0]> + <c1*v[1],v[0]> + <c2*v[2],v[0]> <x,v[0]> = c0 * <v[0],v[0]> + c1 * <v[1],v[0]> + c2 * <v[2],v[0]> <x,v[0]> = c0 * 1 + c1 * 0 + c2 * 0 <x,v[0]> = c0 <x,v[1]> = ...
Exemple de sortie écran :
--------------------------------
V : orthonormal matrix
-0.5345 +0.5005 -0.6810
-0.2673 -0.8645 -0.4256
-0.8018 -0.0455 +0.5959
x : in the standard basis
+3.0000
+3.0000
-3.0000
v[0] v[1] ... v[n]
-0.5345 +0.5005 -0.6810
-0.2673 -0.8645 -0.4256
-0.8018 -0.0455 +0.5959
Compute x in the V basis :
x = <x,v[0]>*v[0] + <x,v[1]>*v[1] + <x,v[2]>*v[2]
x = +0.0000*v[0] -0.9555*v[1] -5.1075*v[2]
Press return to continue
Press X to stop