Mathc complexes/a340
Installer et compiler ces fichiers dans votre répertoire de travail.
c00c.c |
---|
/* ------------------------------------ */
/* Save as : c00c.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RCA RC3
#define FACTOR_E +1.E-0
/* ------------------------------------ */
/* ------------------------------------ */
double **X_Cosh2A_mZ(
double **M_Value,
double **Cosh2A_Value
)
{
int r;
int c;
nb_Z Cosh2A;
for ( r=R1; r<M_Value[R_SIZE][C0]; r++)
for ( c=C1; c<M_Value[C_SIZE][C0]; c+=C2)
if(((r-R1)*C2)==c-C1)
{
Cosh2A = cosh_Z(i_Z(2.*M_Value[r][c],2.*M_Value[r][c+C1]));
Cosh2A_Value[r][c ] = Cosh2A.r;
Cosh2A_Value[r][c+C1] = Cosh2A.i;
}
return(Cosh2A_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **X_CoshAP2_pls_SinAP2_mZ(
double **M_Value,
double **CoshAP2_pls_SinAP2_Value
)
{
int r;
int c;
nb_Z CoshAP2_pls_SinAP2;
nb_Z Cosh;
nb_Z CoshP2;
nb_Z Sin;
nb_Z SinP2;
for ( r=R1; r<M_Value[R_SIZE][C0]; r++)
for ( c=C1; c<M_Value[C_SIZE][C0]; c+=C2)
if(((r-R1)*C2)==c-C1)
{
Cosh = cosh_Z(i_Z(M_Value[r][c],M_Value[r][c+C1]));
CoshP2 = mul_Z(Cosh,Cosh);
Sin = sin_Z(i_Z(M_Value[r][c],M_Value[r][c+C1]));
SinP2 = mul_Z(Sin,Sin);
CoshAP2_pls_SinAP2 = add_Z(CoshP2,SinP2);
CoshAP2_pls_SinAP2_Value[r][c ] = CoshAP2_pls_SinAP2.r;
CoshAP2_pls_SinAP2_Value[r][c+C1] = CoshAP2_pls_SinAP2.i;
}
return(CoshAP2_pls_SinAP2_Value);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
int r = RCA;
int c = RCA;
double **A = rE_mZ(i_mZ(r,c),99,+1.E-4);
double **A_T = ctranspose_mZ(A,i_mZ(c,r));
double **V = i_mZ(r,c);
double **V_T = i_mZ(c,r);
double **U = i_mZ(r,c);
double **U_T = i_mZ(c,r);
double **U_TA = i_mZ(c,c);
double **X = i_mZ(c,c);
double **T1 = i_mZ(c,c);
double **CoshAP2_pls_SinAP2 = i_mZ(c,c);
double **Cosh2A = i_mZ(c,c);
clrscrn();
printf(" A :");
p_mZ(A, S9,P4, S8,P4, C3);
printf(" U :");
X_U_mZ(A_T,U,FACTOR_E);
p_mZ(U, S9,P4, S8,P4, C3);
printf(" V :");
X_V_mZ(A_T,V,FACTOR_E);
p_mZ(V, S9,P4, S8,P4, C3);
ctranspose_mZ(U,U_T);
ctranspose_mZ(V,V_T);
printf(" X = U_T * A * V :");
mul_mZ(U_T, A, U_TA);
mul_mZ(U_TA, V, X);
p_mZ(X, S9,P4, S8,P4, C3);
stop();
clrscrn();
printf(" cosh(2 A) :");
X_Cosh2A_mZ(X,Cosh2A);
mul_mZ(V,Cosh2A,T1);
mul_mZ(T1,U_T,Cosh2A);
pE_mZ(Cosh2A, S12,P4, S8,P4, C3);
printf(" cosh(A)**2 + sin(A)**2 :");
X_CoshAP2_pls_SinAP2_mZ(X,CoshAP2_pls_SinAP2);
mul_mZ(V,CoshAP2_pls_SinAP2,T1);
mul_mZ(T1,U_T,CoshAP2_pls_SinAP2);
pE_mZ(CoshAP2_pls_SinAP2, S12,P4, S8,P4, C3);
f_mZ(A);
f_mZ(A_T);
f_mZ(V);
f_mZ(V_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(X);
f_mZ(Cosh2A);
f_mZ(CoshAP2_pls_SinAP2);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+0.1120 -0.2270i -0.1490 -0.0420i -0.2280 -0.2850i
-0.2860 +0.0480i +0.4550 -0.0410i +0.0720 +0.3770i
-0.2490 +0.2280i -0.1940 +0.0680i -0.5390 +0.1400i
U :
+0.1020 -0.4818i -0.1203 +0.0455i +0.0733 +0.8576i
+0.0702 +0.6042i -0.1654 -0.6638i +0.2407 +0.3225i
+0.6224 +0.0000i +0.7180 +0.0000i +0.3116 +0.0000i
V :
+0.2784 +0.2131i -0.4058 -0.6252i -0.5632 -0.0660i
+0.2352 -0.3634i +0.6335 +0.0000i -0.5214 +0.3735i
+0.8305 +0.0000i +0.1171 -0.1717i +0.5168 +0.0000i
X = U_T * A * V :
-0.2106 +0.0008i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i -0.0919 +0.4801i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0427 +0.1351i
Press return to continue.
cosh(2 A) :
-1.6033e-01+6.8175e-01i +2.6203e-01-1.8023e-01i -2.1811e-01-9.7062e-02i
+4.3034e-01+5.4315e-01i -2.2963e-01+3.2797e-01i +2.6479e-01-2.0664e-01i
+1.2894e-01+2.0496e-02i +2.5860e-01-6.5788e-01i +7.4959e-01-8.1265e-02i
cosh(A)**2 + sin(A)**2 :
-1.5846e-01+6.7836e-01i +2.4413e-01-1.8809e-01i -2.2199e-01-7.7233e-02i
+4.3129e-01+5.4587e-01i -2.1553e-01+3.1926e-01i +2.5200e-01-2.1828e-01i
+1.2993e-01+2.0171e-02i +2.5872e-01-6.6259e-01i +7.4335e-01-7.9999e-02i
Press return to continue
Press X return to stop