Mathc matrices/c11gn
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
/* ------------------------------------ */
/* ------------------------------------ */
double f(
double x)
{
return(sin(x)*sin(x));
}
char feq[] = "sin(x)*sin(x)";
/* ------------------------------------ */
double g(
double x)
{
return(cos(x)*cos(x));
}
char geq[] = "cos(x)*cos(x)";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = rsymmetric_mR(i_mR(RCA,RCA),999.);
double **sin_A = i_mR(RCA,RCA);
double **cos_A = i_mR(RCA,RCA);
double **Ide = i_mR(RCA,RCA);
double **EigsVector = i_mR(RCA,RCA);
double **T_EigsVector = i_mR(RCA,RCA);
double **EigsValue = i_mR(RCA,RCA);
double **sin_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);
stop();
clrscrn();
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(" sin(A)**2");
f_eigs_mR(f,EigsValue,sin_EigsValue);
mul_mR(EigsVector,sin_EigsValue,T1);
mul_mR(T1,T_EigsVector,sin_A);
p_mR(sin_A,S10,P4,C6);
printf(" cos(A)**2");
f_eigs_mR(g,EigsValue,cos_EigsValue);
mul_mR(EigsVector,cos_EigsValue,T1);
mul_mR(T1,T_EigsVector,cos_A);
p_mR(cos_A,S10,P4,C6);
printf(" Ide : cos(A)**2 + sin(A)**2");
add_mR(sin_A,cos_A,Ide);
p_mR(Ide,S10,P4,C6);
f_mR(A);
f_mR(sin_A);
f_mR(cos_A);
f_mR(Ide);
f_mR(EigsVector);
f_mR(T_EigsVector);
f_mR(EigsValue);
f_mR(cos_EigsValue);
f_mR(sin_EigsValue);
f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Ide = cos(A)**2 + sin(A)**2
Exemple de sortie écran :
------------------------------------
A :
+143.0000 -684.0000 -726.0000 -534.0000 -425.0000
-684.0000 -504.0000 +583.0000 +871.0000 +398.0000
-726.0000 +583.0000 -638.0000 +110.0000 -639.0000
-534.0000 +871.0000 +110.0000 +947.0000 +584.0000
-425.0000 +398.0000 -639.0000 +584.0000 -925.0000
Press return to continue.
------------------------------------
sin(A)**2
+0.6908 -0.1188 +0.1102 -0.1057 -0.1737
-0.1188 +0.5686 +0.0103 +0.1863 -0.0077
+0.1102 +0.0103 +0.6344 +0.1702 -0.0023
-0.1057 +0.1863 +0.1702 +0.7645 -0.0295
-0.1737 -0.0077 -0.0023 -0.0295 +0.7299
cos(A)**2
+0.3092 +0.1188 -0.1102 +0.1057 +0.1737
+0.1188 +0.4314 -0.0103 -0.1863 +0.0077
-0.1102 -0.0103 +0.3656 -0.1702 +0.0023
+0.1057 -0.1863 -0.1702 +0.2355 +0.0295
+0.1737 +0.0077 +0.0023 +0.0295 +0.2701
Ide : cos(A)**2 + sin(A)**2
+1.0000 -0.0000 -0.0000 -0.0000 +0.0000
-0.0000 +1.0000 +0.0000 +0.0000 +0.0000
-0.0000 +0.0000 +1.0000 +0.0000 +0.0000
-0.0000 +0.0000 +0.0000 +1.0000 -0.0000
+0.0000 +0.0000 +0.0000 -0.0000 +1.0000
Press return to continue
Press X to stop