Mathc matrices/c33 2a
Apparence
Installer et compiler ce fichier dans votre répertoire de travail.
c02a.c |
---|
/* ------------------------------------ */
/* Save as : c02a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = i_mR(r,r);
double **A_2 = i_mR(r,r);
double **B = i_mR(r,r);
double **B_2 = i_mR(r,r);
double **AplsB = i_mR(r,r);
double **AplsB_2 = i_mR(r,r);
double **AB = i_mR(r,r);
double **AB2 = i_mR(r,r);
double **T1 = i_mR(r,r);
double **T2 = i_mR(r,r);
r_commute2_mR(A,B,9);
clrscrn();
printf(" A : ");
p_mR(A,S5,P3,C6);
printf(" B : ");
p_mR(B,S5,P3,C6);
stop();
clrscrn();
printf(" (A+B)**2 :\n");
add_mR(A,B,AplsB);
pow_mR(2,AplsB,AplsB_2);
p_mR(AplsB_2,S8,P3,C6);
printf(" A**2 + 2*AB + B**2 :\n");
pow_mR(2,A,A_2);
mul_mR(A,B,AB);
smul_mR(2,AB,AB2);
pow_mR(2,B,B_2);
add_mR(A_2,AB2,T1);
add_mR(T1,B_2,T2);
p_mR(T2,S8,P3,C6);
f_mR(A);
f_mR(A_2);
f_mR(B);
f_mR(B_2);
f_mR(AplsB);
f_mR(AplsB_2);
f_mR(AB);
f_mR(AB2);
f_mR(T1);
f_mR(T2);
}
/* ------------------------------------ */
void hello(void)
{
printf("\n ");
printf("\n Commutative matrices ");
printf("\n ");
printf("\n (A+B)**2 = A** + 2*AB + B**2 ");
printf("\n ********************** \n");
printf("\n\n ");
printf("\n \n");
stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
hello();
do
{
fun(RC5);
} while(stop_w());
return 0;
}
/*------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+4.707 -11.338 +8.209 -9.622 +17.082
-2.071 +3.802 -3.334 +4.022 -6.420
+0.570 -0.986 +0.033 -0.617 +1.849
+1.115 -2.084 +1.672 -2.464 +3.269
-2.568 +5.536 -3.969 +4.724 -8.904
B :
-15.646 +34.640 -25.598 +30.217 -51.352
+9.909 -21.643 +15.871 -19.648 +32.179
+1.375 -4.980 +3.641 -4.775 +5.650
-4.343 +7.980 -6.116 +7.082 -13.228
+8.107 -17.779 +12.952 -15.749 +26.457
Press return to continue.
(A+B)**2 :
+12.147 -25.871 +19.084 -22.706 +38.065
-8.050 +18.635 -13.063 +16.453 -26.393
-1.941 +6.235 -3.789 +5.893 -7.451
+2.809 -4.751 +3.746 -3.538 +8.394
-6.258 +14.009 -10.140 +12.530 -19.949
A**2 + 2*AB + B**2 :
+12.147 -25.871 +19.084 -22.706 +38.065
-8.050 +18.635 -13.063 +16.453 -26.393
-1.941 +6.235 -3.789 +5.893 -7.451
+2.809 -4.751 +3.746 -3.538 +8.394
-6.258 +14.009 -10.140 +12.530 -19.949
Press return to continue
Press X to stop