Mathc complexes/a114
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
#define RCA RC4
/* ------------------------------------ */
/* ------------------------------------ */
double f(
double x)
{
return(sin(2*x));
}
char feq[] = "sin(2*x)";
/* ------------------------------------ */
double g(
double x)
{
return(2*sin(x)*cos(x));
}
char geq[] = "2*sin(x)*cos(x)";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = rcsymmetric_mRZ(i_mZ(RCA,RCA),99.);
double **sin2_A = i_mZ(RCA,RCA);
double **sincos_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 **sin2_EigsValue = i_mZ(RCA,RCA);
double **sincos_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,sin2_EigsValue);
f_eigs_mZ(g,EigsValue,sincos_EigsValue);
//A == EigsVector * EigsValue * T_EigsVector
mul_mZ(EigsVector,sin2_EigsValue,T1);
mul_mZ(T1,T_EigsVector,sin2_A);
printf(" sin(2*A)");
p_mRZ(sin2_A,S10,P4,C6);
//A == EigsVector * EigsValue * T_EigsVector
mul_mZ(EigsVector,sincos_EigsValue,T1);
mul_mZ(T1,T_EigsVector,sincos_A);
printf(" 2*sin(A)*cos(A)");
p_mRZ(sincos_A,S10,P4,C6);
f_mZ(A);
f_mZ(sin2_A);
f_mZ(sincos_A);
f_mZ(EigsVector);
f_mZ(T_EigsVector);
f_mZ(EigsValue);
f_mZ(sincos_EigsValue);
f_mZ(sin2_EigsValue);
f_mZ(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
sin(2*A) == 2*sin(A)*cos(A)
Exemple de sortie écran :
------------------------------------
A :
+20171 +14441 -5553 -10633
+14441 +18292 -7873 -7123
-5553 -7873 +21016 +6657
-10633 -7123 +6657 +30931
sin(2*A)
-0.0226 -0.0103 -0.1961 -0.2498
-0.0103 +0.1161 +0.1926 +0.0158
-0.1961 +0.1926 +0.0035 +0.2703
-0.2498 +0.0158 +0.2703 +0.0124
2*sin(A)*cos(A)
-0.0226 -0.0103 -0.1961 -0.2498
-0.0103 +0.1161 +0.1926 +0.0158
-0.1961 +0.1926 +0.0035 +0.2703
-0.2498 +0.0158 +0.2703 +0.0124
Press return to continue
Press X to stop