Mathc matrices/c11hn
Fonctions matricielles ex : cos(A)
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC5
/* ------------------------------------ */
/* ------------------------------------ */
double f(
double x)
{
return(cos(2*x));
}
char feq[] = "cos(2*x)";
/* ------------------------------------ */
double g(
double x)
{
return(2*cos(x)*cos(x)-1);
}
char geq[] = "2*cos(x)**2)-1";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = rsymmetric_mR(i_mR(RCA,RCA),999.);
double **cos2_A = i_mR(RCA,RCA);
double **coscosmns1_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 **cos2A_EigsValue = i_mR(RCA,RCA);
double **coscosmns1_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(" cos(2*A)");
f_eigs_mR(f,EigsValue,cos2A_EigsValue);
mul_mR(EigsVector,cos2A_EigsValue,T1);
mul_mR(T1,T_EigsVector,cos2_A);
p_mR(cos2_A,S10,P4,C6);
printf(" 2*cos(A)**2-1");
f_eigs_mR(g,EigsValue,coscosmns1_EigsValue);
mul_mR(EigsVector,coscosmns1_EigsValue,T1);
mul_mR(T1,T_EigsVector,coscosmns1_A);
p_mR(coscosmns1_A,S10,P4,C6);
f_mR(A);
f_mR(cos2_A);
f_mR(coscosmns1_A);
f_mR(EigsVector);
f_mR(T_EigsVector);
f_mR(EigsValue);
f_mR(coscosmns1_EigsValue);
f_mR(cos2A_EigsValue);
f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
cos(2*A) = 2*cos(A)**2-1 Exemple de sortie écran :
------------------------------------
A :
+781.0000 -555.0000 -738.0000 -666.0000 -7.0000
-555.0000 -387.0000 -45.0000 +83.0000 +996.0000
-738.0000 -45.0000 +207.0000 +78.0000 +323.0000
-666.0000 +83.0000 +78.0000 -391.0000 -462.0000
-7.0000 +996.0000 +323.0000 -462.0000 -907.0000
Press return to continue.
------------------------------------
cos(2*A)
+0.7610 -0.1953 -0.2089 +0.1112 -0.1504
-0.1953 -0.0576 +0.1319 +0.3938 -0.3194
-0.2089 +0.1319 +0.3456 +0.2168 +0.0344
+0.1112 +0.3938 +0.2168 +0.3295 +0.3270
-0.1504 -0.3194 +0.0344 +0.3270 -0.1389
2*cos(A)**2-1
+0.7610 -0.1953 -0.2089 +0.1112 -0.1504
-0.1953 -0.0576 +0.1319 +0.3938 -0.3194
-0.2089 +0.1319 +0.3456 +0.2168 +0.0344
+0.1112 +0.3938 +0.2168 +0.3295 +0.3270
-0.1504 -0.3194 +0.0344 +0.3270 -0.1389
Press return to continue
Press X to stop