Mathc matrices/cq052
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : cq2.c */
void fun(int r)
double **Q = r_Q_mR(i_mR(r,r), 9);
double **QT = i_mR(r,r);
double **T = i_mR(r,r);
 clrscrn(); 
 printf(" Q : an orthonormal matrix");
 p_mR(Q,S3,P3,C6);
 printf(" QT :");
 transpose_mR(Q,QT);
 p_mR(QT,S3,P3,C6); 
 stop();
 clrscrn();
 printf(" Q * QT : (QT = inv(Q)");
 mul_mR(Q,QT,T);
 p_mR(T,S3,P0,C6); 
 printf(" QT * Q : (Q = inv(QT)");
 mul_mR(QT,Q,T);
 p_mR(T,S3,P0,C6); 
 f_mR(Q);
 f_mR(QT);
 f_mR(T);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(R3)+R2);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 La transposée d'une matrice orthogonale est son inverse :

Exemple de sortie écran :
 Q : an orthogonal matrix (orthonormal !!)
+0.943 -0.329 +0.054 
-0.236 -0.772 -0.591 
-0.236 -0.544 +0.805 
 QT :
+0.943 -0.236 -0.236 
-0.329 -0.772 -0.544 
+0.054 -0.591 +0.805 
 Q * QT : (QT = inv(Q)
 +1 -0 -0 
 -0 +1 +0 
 -0 +0 +1 
 QT * Q : (Q = inv(QT)
 +1 -0 +0 
 -0 +1 +0 
 +0 +0 +1 
 Press return to continue
 Press X to stop

Mathc matrices/cq053
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : cq3.c */
void fun(int r)
double **A = r_Q_mR(i_mR(r,r), 9);
double **B = r_Q_mR(i_mR(r,r), 9);
double **AB = i_mR(r,r);
double **ABT = i_mR(r,r);
double **T = i_mR(r,r);
 clrscrn();
 printf(" A : an orthonormal matrix ");
 p_mR(A,S3,P3,C6); 
 printf(" B : an orthonormal matrix ");
 p_mR(B,S3,P3,C6);
 stop();
 clrscrn();
 printf(" A * B = AB : AB is an orthonormal matrix");
 mul_mR(A,B,AB);
 p_mR(AB,S3,P3,C6); 
 printf(" AB * ABT = id : inv(AB) = ABT ");
 transpose_mR(AB,ABT);
 mul_mR(AB,ABT,T);
 p_mR(T,S3,P3,C6); 
 f_mR(A);
 f_mR(B);
 f_mR(AB);
 f_mR(ABT);
 f_mR(T);
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun(rp_I(R3)+R2);
} while(stop_w());
 return 0;
/* ------------------------------------ */
 Le produit de deux matrices orthogonales est orthogonale :

Exemple de sortie écran :
 A : an orthonormal matrix 
-0.199 +0.456 -0.160 +0.805 +0.281 
+0.597 +0.477 +0.112 -0.296 +0.562 
-0.299 +0.443 +0.801 -0.075 -0.259 
+0.597 -0.405 +0.457 +0.507 -0.114 
-0.398 -0.452 +0.333 -0.030 +0.725 
 B : an orthonormal matrix 
+0.273 -0.738 +0.484 +0.054 +0.379 
+0.479 -0.094 +0.220 +0.152 -0.831 
+0.615 +0.580 +0.193 +0.302 +0.395 
-0.137 +0.307 +0.666 -0.663 -0.058 
+0.547 -0.125 -0.486 -0.666 +0.078 
 Press return to continue. 
 A * B = AB : AB is an orthonormal matrix
+0.109 +0.224 +0.373 -0.710 -0.542 
+0.808 -0.582 -0.055 -0.038 -0.065 
+0.492 +0.653 +0.183 +0.515 -0.181 
+0.119 +0.033 +0.681 -0.152 +0.705 
+0.280 +0.429 -0.600 -0.453 +0.414 
 AB * ABT = id : inv(AB) = ABT 
+1.000 -0.000 +0.000 -0.000 +0.000 
-0.000 +1.000 -0.000 +0.000 +0.000 
+0.000 -0.000 +1.000 -0.000 -0.000 
-0.000 +0.000 -0.000 +1.000 -0.000 
+0.000 +0.000 -0.000 -0.000 +1.000 
 Press return to continue
 Press X to stop

Mathc matrices/cq054
Application ou Pseudo Inverse
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c01c.c */
/* ------------------------------------ */
void fun(void)
double tA[RA*CA]={
/* x**0 x**1 x**2 */
 1, .1, .01, 
 1, .2, .04, 
 1, .3, .09, 
 1, .4, .16, 
 1, .5, .25
double tb[RA*C1]={
/* y */
 -0.19,
 0.32,
 1.04,
 2.47,
 3.74
double **A = ca_A_mR(tA,i_mR(RA,CA));
double **b = ca_A_mR(tb,i_mR(RA,C1));
double **Pinv = i_mR(CA,RA); 
double **Pinvb = i_mR(CA,C1); 
 clrscrn();
 printf(" Fitting a linear Curve to Data :\n\n");
 printf(" A :");
 p_mR(A,S5,P2,C7);
 printf(" b :");
 p_mR(b,S5,P2,C7);
 printf(" Pinv = V * invS_T * U_T ");
 pseudo_Rn_uv_mR(A,Pinv,FACTOR_E); 
 pE_mR(Pinv,S12,P4,C10); 
 stop();
 clrscrn(); 
 printf(" x = Pinv * b "); 
 mul_mR(Pinv,b,Pinvb); 
 p_mR(Pinvb,S10,P4,C10);
 printf(" The Quadratic Curve to Data : \n\n"
 " s = %+.2f %+.2f*t %+.2f*t**2\n\n"
 ,Pinvb[R1][C1],Pinvb[R2][C1],Pinvb[R3][C1]); 
 stop(); 
 f_mR(b);
 f_mR(A);
 f_mR(Pinv);
 f_mR(Pinvb); 
/* ------------------------------------ */
int main(void)

Exemple de sortie écran :
 Fitting a linear Curve to Data :
 A :
+1.00 +0.10 +0.01 
+1.00 +0.20 +0.04 
+1.00 +0.30 +0.09 
+1.00 +0.40 +0.16 
+1.00 +0.50 +0.25 
 b :
-0.19 
+0.32 
+1.04 
+2.47 
+3.74 
 Pinv = V * invS_T * U_T 
 +1.8000 -0.0000 -0.8000 -0.6000 +0.6000 
 -10.5714 +3.2857 +8.5714 +5.2857 -6.5714 
 +14.2857 -7.1429 -14.2857 -7.1429 +14.2857 
 Press return to continue. 
 -----------------------------------
 x = Pinv * b 
 -0.4120 
 +0.4529 
 +15.9286 
 The Quadratic Curve to Data : 
 s = -0.41 +0.45*t +15.93*t**2
 Press return to continue.

Mathc matrices/cq055
Application ou Pseudo Inverse 
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c01d.c */
/* ------------------------------------ */
void fun(void)
double tA[RA*CA]={
/* x**0 x**1 x**2 x**3 */
 1, -5., +25., -125.,
 1, -2., +4., -8.,
 1, +2., +4., +8.,
 1, +3., +9., +27.
double tb[RA*C1]={
/* y */
 -3.00 ,
 +0.00,
 +3.00,
 -2.00,
double **A = ca_A_mR(tA,i_mR(RA,CA));
double **b = ca_A_mR(tb,i_mR(RA,C1));
double **Pinv = i_mR(CA,RA); 
double **Pinvb = i_mR(CA,C1); 
 clrscrn();
 printf(" Fitting a linear Curve to Data :\n\n");
 printf(" A :");
 p_mR(A,S10,P2,C7);
 printf(" b :");
 p_mR(b,S10,P2,C7);
 printf(" Pinv = V * invS_T * U_T ");
 pseudo_Rn_uv_mR(A,Pinv,FACTOR_E); 
 pE_mR(Pinv,S12,P4,C10); 
 stop();
 clrscrn(); 
 printf(" x = Pinv * b "); 
 mul_mR(Pinv,b,Pinvb); 
 p_mR(Pinvb,S10,P4,C10);
 printf(" The Cubic equation Curve to Data : \n\n"
 " s = %+.3f %+.3f*t %+.3f*t**2 %+.3f*t**3\n\n"
 ,Pinvb[R1][C1],Pinvb[R2][C1],
 Pinvb[R3][C1],Pinvb[R4][C1]); 
 stop(); 
 f_mR(b); 
 f_mR(A); 
 f_mR(Pinv);
 f_mR(Pinvb); 
/* ------------------------------------ */
int main(void)

Exemple de sortie écran :
 Fitting a linear Curve to Data :
 A :
 +1.00 -5.00 +25.00 -125.00 
 +1.00 -2.00 +4.00 -8.00 
 +1.00 +2.00 +4.00 +8.00 
 +1.00 +3.00 +9.00 +27.00 
 b :
 -3.00 
 +0.00 
 +3.00 
 -2.00 
 Pinv = V * invS_T * U_T 
 -0.0714 +0.5000 +1.0714 -0.5000 
 +0.0238 -0.3167 +0.3929 -0.1000 
 +0.0179 -0.0000 -0.1429 +0.1250 
 -0.0060 +0.0167 -0.0357 +0.0250 
 Press return to continue. 
 -----------------------------------
 x = Pinv * b 
 +4.4286 
 +1.3071 
 -0.7321 
 -0.1393 
 The Cubic equation Curve to Data : 
 s = +4.429 +1.307*t -0.732*t**2 -0.139*t**3
 Press return to continue.

Mathc complexes/a05
Bibliothèque
Copier la bibliothèque dans votre répertoire de travail avec les fichiers des parties précédentes :
Exemple pour tester la bibliothèque :

Mathc complexes/h05a
Bibliothèque
Total Pivoting :
----

Mathc complexes/h05b
Installer et compiler ce fichier dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c00a.c */
int main(void)
double **A = r_mZ(i_mZ(R5,C5),9);
 printf("A :"); 
 P_mZ(A, S5,P0, S4,P0,C6);
 stop();
 f_mZ(A);
 return 0;
/* ------------------------------------ */
Exemple de sortie écran :
A :
 +2, -1i, -6, +2i, -7, -6i, -6, +6i, +7, +8i, 
 +9, -7i, +9, -9i, -2, +6i, +1, -6i, +2, +5i, 
 -7, -1i, -6, +6i, +3, +3i, +2, -9i, +6, -5i, 
 -7, -6i, -3, -8i, -5, -1i, -1, -3i, +3, +7i, 
 +8, +7i, +6, -7i, -9, +7i, +9, +2i, +8, -4i 
 Press return to continue.