Mathc complexes/a113
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
#define RCA RC4
/* ------------------------------------ */
/* ------------------------------------ */
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 = rcsymmetric_mRZ(i_mZ(RCA,RCA),99.);
double **cos2_A = i_mZ(RCA,RCA);
double **coscosmns1_A = i_mZ(RCA,RCA);
double **EigsVector = i_mZ(RCA,RCA);
double **T_EigsVector = i_mZ(RCA,RCA);
double **EigsValue = i_mZ(RCA,RCA);
double **cos2A_EigsValue = i_mZ(RCA,RCA);
double **coscosmns1_EigsValue = i_mZ(RCA,RCA);
double **T1 = i_mZ(RCA,RCA);
clrscrn();
printf(" A :");
p_mRZ(A, S10,P0, C6);
eigs_V_mZ(A,EigsVector,FACTOR_E);
transpose_mZ(EigsVector,T_EigsVector);
/* EigsValue : T_EigsVector * A * EigsVector */
mul_mZ(T_EigsVector,A,T1);
mul_mZ(T1,EigsVector,EigsValue);
f_eigs_mZ(f,EigsValue,cos2A_EigsValue);
f_eigs_mZ(g,EigsValue,coscosmns1_EigsValue);
//A == EigsVector * EigsValue * T_EigsVector
mul_mZ(EigsVector,cos2A_EigsValue,T1);
mul_mZ(T1,T_EigsVector,cos2_A);
printf(" cos(2*A)");
p_mRZ(cos2_A,S10,P4,C6);
//A == EigsVector * EigsValue * T_EigsVector
mul_mZ(EigsVector,coscosmns1_EigsValue,T1);
mul_mZ(T1,T_EigsVector,coscosmns1_A);
printf(" 2*cos(A)**2-1");
p_mRZ(coscosmns1_A,S10,P4,C6);
f_mZ(A);
f_mZ(cos2_A);
f_mZ(coscosmns1_A);
f_mZ(EigsVector);
f_mZ(T_EigsVector);
f_mZ(EigsValue);
f_mZ(coscosmns1_EigsValue);
f_mZ(cos2A_EigsValue);
f_mZ(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 :
+9692 +11174 +730 -3472
+11174 +17044 +4688 -5862
+730 +4688 +18830 -9521
-3472 -5862 -9521 +6222
cos(2*A)
+0.3337 -0.1474 +0.5458 -0.0180
-0.1474 +0.3672 +0.5044 -0.2417
+0.5458 +0.5044 +0.0808 +0.2834
-0.0180 -0.2417 +0.2834 +0.8453
2*cos(A)**2-1
+0.3337 -0.1474 +0.5458 -0.0180
-0.1474 +0.3672 +0.5044 -0.2417
+0.5458 +0.5044 +0.0808 +0.2834
-0.0180 -0.2417 +0.2834 +0.8453
Press return to continue
Press X to stop