Mathc matrices/a84
Apparence
Fonctions matricielles ex : cos(A)
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC5
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = rEsymmetric_mR(i_mR(RCA,RCA),555.,1E-3);
double **cos_A = i_mR(RCA,RCA);
double **EigsVector = i_mR(RCA,RCA);
double **T_EigsVector = i_mR(RCA,RCA);
double **EigsValue = i_mR(RCA,RCA);
double **cos_EigsValue = i_mR(RCA,RCA);
double **T1 = i_mR(RCA,RCA);
clrscrn();
printf(" A :");
p_mR(A,S10,P4,C6);
/* ================================================================== */
eigs_V_mR(A,EigsVector);
transpose_mR(EigsVector,T_EigsVector);
/* EigsValue : T_EigsVector * A * EigsVector */
mul_mR(T_EigsVector,A,T1);
mul_mR(T1,EigsVector,EigsValue);
printf(" cos(A) :");
f_eigs_mR(cos,EigsValue,cos_EigsValue);
mul_mR(EigsVector,cos_EigsValue,T1);
mul_mR(T1,T_EigsVector,cos_A);
p_mR(cos_A,S10,P4,C6);
/* ================================================================== */
eigs_V_mR(cos_A,EigsVector);
transpose_mR(EigsVector,T_EigsVector);
/* EigsValue : T_EigsVector * cos_A * EigsVector */
mul_mR(T_EigsVector,cos_A,T1);
mul_mR(T1,EigsVector,EigsValue);
printf(" acos(cos(A)) = A :");
f_eigs_mR(acos,EigsValue,cos_EigsValue);
mul_mR(EigsVector,cos_EigsValue,T1);
mul_mR(T1,T_EigsVector,A);
p_mR(A,S10,P4,C6);
f_mR(A);
f_mR(cos_A);
f_mR(EigsVector);
f_mR(T_EigsVector);
f_mR(EigsValue);
f_mR(cos_EigsValue);
f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
acos(cos(A)) = A Exemple de sortie écran :
------------------------------------
A :
+0.2584 -0.1805 -0.2321 -0.1239 -0.0287
-0.1805 +0.4288 +0.2662 -0.1582 -0.1468
-0.2321 +0.2662 +0.3610 +0.1499 +0.0574
-0.1239 -0.1582 +0.1499 +0.4023 +0.3353
-0.0287 -0.1468 +0.0574 +0.3353 +0.7024
cos(A) :
+0.9199 +0.0767 +0.1000 +0.0457 +0.0252
+0.0767 +0.8428 -0.1043 +0.0545 +0.0907
+0.1000 -0.1043 +0.8674 -0.0561 -0.0359
+0.0457 +0.0545 -0.0561 +0.8442 -0.1855
+0.0252 +0.0907 -0.0359 -0.1855 +0.7090
acos(cos(A)) = A :
+0.2584 -0.1805 -0.2321 -0.1239 -0.0287
-0.1805 +0.4288 +0.2662 -0.1582 -0.1468
-0.2321 +0.2662 +0.3610 +0.1499 +0.0574
-0.1239 -0.1582 +0.1499 +0.4023 +0.3353
-0.0287 -0.1468 +0.0574 +0.3353 +0.7024
Press return to continue
Press X return to stop