Mathc matrices/c25d
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c02a.c */
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
double **B = r_Q_mR( i_mR(RCB,RCB), 9);
double **invB = inv_mR(B,i_mR(RCB,RCB));
double **b[RCB];
double **x = r_mR(i_mR(RCB,C1),9.);
double **x_b = i_mR(RCB,C1) ;
int c;
/* ------------------------------------ */
 for(c=C0; c<csize_R(B); c++)
 b[c] = i_mR(RCB,C1); 
/* ------------------------------------ */
 clrscrn();
 printf(" B is the change of basis matrix for the basis \"B\" \n\n"
 " B : orthonormal matrix");
 p_mR(B,S10,P4,C7);
 printf("invB : invB == B_T");
 p_mR(invB,S10,P4,C7);
 stop(); 
/* ------------------------------------ */
 clrscrn();
 printf(" x :"); 
 p_mR(x,S10,P4,C6); 
 printf(" Compute x in the B basis :\n\n"
 " x_b = invB * x :");
 p_mR(mul_mR(invB,x,x_b),S10,P4,C7); 
 stop(); 
/* ------------------------------------ */
 clrscrn();
 printf(" x :"); 
 p_mR(x,S10,P4,C6); 
 printf(" b[1] b[2] ... b[n]\n");
 p_mR(B,S10,P4,C7);
 printf(" Compute x in the B basis : \n\n"
 " x_b : x_b = <b[i],x>\n");
 for(c=C0; c<csize_R(B); c++) 
 printf("%+10.4f <b[%d],x>\n",dot_uv_R(b[c],x),c);
 printf("\n\n"); 
 stop(); 
/* ------------------------------------ */ 
 clrscrn(); 
 printf(" Compute x in the B basis : \n\n"
 " x_b : x_b = invB * x"); 
 p_mR(x_b,S10,P4,C6); 
 printf(" x_b : x_b = <b[i],x>\n");
 for(c=C0; c<csize_R(B); c++) 
 printf("%+10.4f <b[%d],x>\n",dot_uv_R(b[c],x),c); 
 printf("\n\n"); 
/* ------------------------------------ */
 for(c=C0; c<csize_R(B); c++)
 f_mR(b[c]); 
 f_mR(x); 
 f_mR(B);
 f_mR(invB);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun();
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Présentation de deux algorithmes pour calculer la valeur de x en base b

x_b = invB * x
 x_b = 
 Pour changer la taille des vecteurs il suffit de modifier la valeur de :

Exemple de sortie écran :
 B is the change of basis matrix for the basis "B" 
 B : orthonormal matrix
 +0.4815 -0.4999 +0.0651 +0.7169 
 +0.7223 +0.0673 +0.4906 -0.4828 
 +0.4815 +0.1882 -0.8482 -0.1151 
 -0.1204 -0.8427 -0.1889 -0.4896 
invB : invB == B_T
 +0.4815 +0.7223 +0.4815 -0.1204 
 -0.4999 +0.0673 +0.1882 -0.8427 
 +0.0651 +0.4906 -0.8482 -0.1889 
 +0.7169 -0.4828 -0.1151 -0.4896 
 Press return to continue. 
 --------------------------------
 x :
 +6.0000 
 +6.0000 
 -4.0000 
 +1.0000 
 Compute x in the B basis :
 x_b = invB * x :
 +5.1766 
 -4.1911 
 +6.5380 
 +1.3758 
 Press return to continue. 
 --------------------------------
 x :
 +6.0000 
 +6.0000 
 -4.0000 
 +1.0000 
 b[1] b[2] ... b[n]
 +0.4815 -0.4999 +0.0651 +0.7169 
 +0.7223 +0.0673 +0.4906 -0.4828 
 +0.4815 +0.1882 -0.8482 -0.1151 
 -0.1204 -0.8427 -0.1889 -0.4896 
 Compute x in the B basis : 
 x_b : x_b = <b[i],x>
 +5.1766 <b[0],x>
 -4.1911 <b[1],x>
 +6.5380 <b[2],x>
 +1.3758 <b[3],x>
 Press return to continue. 
 --------------------------------
 Compute x in the B basis : 
 x_b : x_b = invB * x
 +5.1766 
 -4.1911 
 +6.5380 
 +1.3758 
 x_b : x_b = <b[i],x>
 +5.1766 <b[0],x>
 -4.1911 <b[1],x>
 +6.5380 <b[2],x>
 +1.3758 <b[3],x>
 Press return to continue
 Press X to stop

Mathc matrices/c25e
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c02b.c */
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)

double tx[RCB*C1]={
 -7, 
 -6, 
 +8 
double tB[RCB*RCB]={
+0.4819, +0.4615, +0.7448, 
+0.6196, -0.7806, +0.0828, 
+0.6196, +0.4216, -0.6621

double **B = ca_A_mR(tB,i_mR(RCB,RCB)); 
double **invB = inv_mR(B, i_mR(RCB,RCB));
double **b[RCB];
double **x = ca_A_mR(tx,i_mR(RCB,C1));
double **x_b = i_mR(RCB,C1) ;
int c;
/* ------------------------------------ */
 for(c=C0; c<csize_R(B); c++)
 b[c] = i_mR(RCB,C1); 
/* ------------------------------------ */
 clrscrn();
 printf(" B is the change of basis matrix for the basis \"B\" \n\n"
 " B : orthonormal matrix");
 p_mR(B,S10,P4,C7);
 printf("invB : invB == B_T");
 p_mR(invB,S10,P4,C7);
 stop(); 
/* ------------------------------------ */
 clrscrn();
 printf(" x :"); 
 p_mR(x,S10,P4,C6); 
 printf(" Compute x in the B basis :\n\n"
 " x_b = invB * x :");
 p_mR(mul_mR(invB,x,x_b),S10,P4,C7); 
 stop(); 
/* ------------------------------------ */
 clrscrn();
 printf(" x :"); 
 p_mR(x,S10,P4,C6); 
 printf(" b[1] b[2] ... b[n]\n");
 p_mR(B,S10,P4,C7);
 printf(" Compute x in the B basis : \n\n"
 " x_b : x_b = <b[i],x>\n");
 for(c=C0; c<csize_R(B); c++) 
 printf("%+10.4f <b[%d],x>\n",dot_uv_R(b[c],x),c);
 printf("\n\n"); 
 stop(); 
/* ------------------------------------ */ 
 clrscrn(); 
 printf(" Compute x in the B basis : \n\n"
 " x_b : x_b = invB * x"); 
 p_mR(x_b,S10,P4,C6); 
 printf(" x_b : x_b = <b[i],x>\n");
 for(c=C0; c<csize_R(B); c++) 
 printf("%+10.4f <b[%d],x>\n",dot_uv_R(b[c],x),c); 
 printf("\n\n"); 
/* ------------------------------------ */
 for(c=C0; c<csize_R(B); c++)
 f_mR(b[c]); 
 f_mR(x); 
 f_mR(B);
 f_mR(invB);
/* ------------------------------------ */
int main(void)
 fun();
 return 0;
/* ------------------------------------ */
 Présentation deux deux algorithmes pour calculer la valeur de x en base b

x_b = invB * x
 x_b = 
 Pour changer la taille des vecteurs il suffit de modifier la valeur de :
 #define RCQ RC4
 et de rajouter éventuellement de nouvelles lignes et colonnes.

Exemple de sortie écran :
 B is the change of basis matrix for the basis "B" 
 B : orthonormal matrix
 +0.4819 +0.4615 +0.7448 
 +0.6196 -0.7806 +0.0828 
 +0.6196 +0.4216 -0.6621 
invB : invB == B_T
 +0.4819 +0.6195 +0.6196 
 +0.4615 -0.7805 +0.4216 
 +0.7449 +0.0828 -0.6621 
 Press return to continue. 
 --------------------------------
 x :
 -7.0000 
 -6.0000 
 +8.0000 
 Compute x in the B basis :
 x_b = invB * x :
 -2.1340 
 +4.8250 
 -11.0074 
 Press return to continue. 
 --------------------------------
 x :
 -7.0000 
 -6.0000 
 +8.0000 
 b[1] b[2] ... b[n]
 +0.4819 +0.4615 +0.7448 
 +0.6196 -0.7806 +0.0828 
 +0.6196 +0.4216 -0.6621 
 Compute x in the B basis : 
 x_b : x_b = <b[i],x>
 -2.1341 <b[0],x>
 +4.8259 <b[1],x>
 -11.0072 <b[2],x>
 Press return to continue. 
 --------------------------------
 Compute x in the B basis : 
 x_b : x_b = invB * x
 -2.1340 
 +4.8250 
 -11.0074 
 x_b : x_b = <b[i],x>
 -2.1341 <b[0],x>
 +4.8259 <b[1],x>
 -11.0072 <b[2],x>