Mathc matrices/c26h
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
cq7.c |
---|
/* ------------------------------------ */
/* Save as : cq7.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RA R3
#define CA C3
#define CB C3
/* ------------------------------------ */
void fun(void)
{
double ta[RA*CA]={
-32.000000000000, +42.738773415448, +7.431481213965,
-32.000000000000, -9.261226584552, -49.077576438090,
-43.000000000000, -24.913523222992, +30.992442957488
};
double tb[RA*CB]={
+90.0000, -88.0000, +26.0000,
-79.0000, +60.0000, -67.0000,
+77.0000, -34.0000, +33.0000
};
double **A = ca_A_mR(ta,i_mR(RA,CA));
double **B = ca_A_mR(tb,i_mR(RA,CB));
double **Ab = i_Abr_Ac_bc_mR(RA,CA,CB);
double **b[CB];
double **a[CA];
int c;
clrscrn();
printf(" A : Orthogonal");
p_mR(A,S9,P4,C6);
printf(" b[C0] b[C1] b[C2] :");
p_mR(B,S9,P1,C6);
printf(" Ab :");
c_A_b_Ab_mR(A,B,Ab);
p_mR(Ab,S9,P4,C6);
printf(" gj_TP_mR(Ab) : x[C0] x[C1] x[C2]");
gj_TP_mR(Ab);
p_mR(Ab,S9,P4,C6);
stop();
/* ------------------------------------ */
/* ------------------------------------ */
for(c=C0; c<CB; c++)
{
b[c] = i_mR(RA,C1);
c_c_mR(B,(c+C1),b[c],C1); }
for(c=C0; c<CA; c++)
{
a[c] = i_mR(RA,C1);
c_c_mR(A,(c+C1),a[c],C1); }
/* ------------------------------------ */
/* ------------------------------------ */
clrscrn();
for(c=C0; c<CA; c++)
{
printf(" a[%d] :",c);
pE_mR(a[c],S12,P4,C6); }
stop();
clrscrn();
for(c=C0; c<CB; c++)
{
printf(" b[%d] :",c);
p_mR(b[c],S12,P4,C6); }
stop();
clrscrn();
printf(" x[C0] :\n");
for(c=C0; c<CA; c++)
printf("%+15.7f <b[C0],a[%d]> / ||a[%d||**2\n",
dot_R(b[C0],a[c])/
dot_R(a[c],a[c]), c,c);
printf("\n x[C1] :\n");
for(c=C0; c<CA; c++)
printf("%+15.7f <b[C0],a[%d]> / ||a[%d||**2\n",
dot_R(b[C1],a[c])/
dot_R(a[c],a[c]), c,c);
printf("\n x[C2] :\n");
for(c=C0; c<CA; c++)
printf("%+15.7f <b[C0],a[%d]> / ||a[%d||**2\n",
dot_R(b[C2],a[c])/
dot_R(a[c],a[c]), c,c);
printf("\n gj_TP_mR(Ab) :\t\t\t x[C0] x[C1] x[C2]");
p_mR(Ab,S12,P7,C6);
stop();
/* ------------------------------------ */
/* ------------------------------------ */
for(c=C0; c<CA; c++)
f_mR(a[c]);
for(c=C0; c<CB; c++)
f_mR(b[c]);
/* ------------------------------------ */
/* ------------------------------------ */
f_mR(Ab);
f_mR(B);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
fun();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Résoudre un système d'équation quand A est une matrice orthogonale : Ici B est composé de trois vecteurs. Exemple de sortie écran :
--------------------------------
A : Orthogonal
-32.0000 +42.7388 +7.4315
-32.0000 -9.2612 -49.0776
-43.0000 -24.9135 +30.9924
b[C0] b[C1] b[C2] :
+90.0 -88.0 +26.0
-79.0 +60.0 -67.0
+77.0 -34.0 +33.0
Ab :
-32.0000 +42.7388 +7.4315 +90.0000 -88.0000 +26.0000
-32.0000 -9.2612 -49.0776 -79.0000 +60.0000 -67.0000
-43.0000 -24.9135 +30.9924 +77.0000 -34.0000 +33.0000
gj_TP_mR(Ab) : x[C0] x[C1] x[C2]
+1.0000 +0.0000 -0.0000 -0.9400 +0.6051 -0.0275
+0.0000 +1.0000 +0.0000 +1.0500 -1.3697 +0.3591
+0.0000 +0.0000 +1.0000 +2.0244 -1.3586 +1.3153
Press return to continue.
--------------------------------
a[0] :
-3.2000e+01
-3.2000e+01
-4.3000e+01
a[1] :
+4.2739e+01
-9.2612e+00
-2.4914e+01
a[2] :
+7.4315e+00
-4.9078e+01
+3.0992e+01
Press return to continue.
--------------------------------
b[0] :
+90.0000
-79.0000
+77.0000
b[1] :
-88.0000
+60.0000
-34.0000
b[2] :
+26.0000
-67.0000
+33.0000
Press return to continue.
--------------------------------
x[C0] :
-0.9399538 <b[C0],a[0]> / ||a[0||**2
+1.0500299 <b[C0],a[1]> / ||a[1||**2
+2.0244267 <b[C0],a[2]> / ||a[2||**2
x[C1] :
+0.6050808 <b[C0],a[0]> / ||a[0||**2
-1.3697387 <b[C0],a[1]> / ||a[1||**2
-1.3586067 <b[C0],a[2]> / ||a[2||**2
x[C2] :
-0.0274570 <b[C0],a[0]> / ||a[0||**2
+0.3590776 <b[C0],a[1]> / ||a[1||**2
+1.3153283 <b[C0],a[2]> / ||a[2||**2
gj_TP_mR(Ab) : x[C0] x[C1] x[C2]
+1.0000000 +0.0000000 -0.0000000 -0.9399538 +0.6050808 -0.0274570
+0.0000000 +1.0000000 +0.0000000 +1.0500299 -1.3697387 +0.3590776
+0.0000000 +0.0000000 +1.0000000 +2.0244267 -1.3586067 +1.3153283
Press return to continue.