Mathc complexes/a121
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 RC3
/* ------------------------------------ */
void fun(void)
{
double **A;
double **LogA_EValue;
double **LogA;
double **Exp_LogA_EValue;
double **Exp_LogA;
double **V = i_mZ(RCA,RCA);
double **V_T = i_mZ(RCA,RCA);
double **EValue = i_mZ(RCA,RCA);
double **T = i_mZ(RCA,RCA);
clrscrn();
A = rEcsymmetric_mZ(i_mZ(RCA,RCA),999,+1.E-3);
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mZ(A,"A", P6, P6);
printf(" logm (A)\n\n\n");
stop();
clrscrn();
LogA_EValue = i_mZ(RCA,RCA);
LogA = i_mZ(RCA,RCA);
printf(" A :");
p_mZ(A, S9,P4, S9,P4, C6);
eigs_V_mZ(A,V,FACTOR_E);
ctranspose_mZ(V,V_T);
/* EValue = V_T * A * V */
mul_mZ(V_T,A,T);
mul_mZ(T,V,EValue);
f_eigs_mZ(log,EValue, LogA_EValue);
printf(" LogA_EValue :");
p_mZ( LogA_EValue, S9,P4, S9,P4, C6);
/* Log_A = V * Log_EValue * V_T*/
mul_mZ(V,LogA_EValue,T);
mul_mZ(T,V_T,LogA);
printf(" LogA");
p_mZ(LogA, S9,P4, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mZ(LogA, "LogA", P6, P6);
printf(" expm (LogA)\n\n\n");
stop();
clrscrn();
Exp_LogA_EValue = i_mZ(RCA,RCA);
Exp_LogA = i_mZ(RCA,RCA);
printf(" LogA :");
p_mZ(LogA, S9,P4, S9,P4, C6);
eigs_V_mZ(LogA,V,FACTOR_E);
ctranspose_mZ(V,V_T);
/* LogA_EValue = V_T * LogA * V */
mul_mZ(V_T,LogA,T);
mul_mZ(T,V,LogA_EValue);
f_eigs_mZ(exp,LogA_EValue, Exp_LogA_EValue);
printf(" Exp_LogA_EValue :");
p_mZ( Exp_LogA_EValue, S9,P4, S9,P4, C6);
/* A = V * Exp_LogA_EValue * V_T*/
mul_mZ(V,Exp_LogA_EValue,T);
mul_mZ(T,V_T,Exp_LogA);
printf(" Exp_LogA = A");
p_mZ(Exp_LogA, S9,P4, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" A :");
p_mZ(A, S9,P4, S9,P4, C6);
printf(" Exp_LogA = A");
p_mZ(Exp_LogA, S9,P4, S9,P4, C6);
f_mZ(A);
f_mZ(LogA_EValue);
f_mZ(LogA);
f_mZ(V);
f_mZ(V_T);
f_mZ(EValue);
f_mZ(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exp( Log(A) ) = A
Exemple de sortie écran :
------------------------------------
Copy/Past into the octave window.
A=[
+1.122315+0.000000*i,+0.236506+0.312157*i,-0.497188+1.116935*i;
+0.236506-0.312157*i,+0.986247+0.000000*i,+0.423536+0.209517*i;
-0.497188-1.116935*i,+0.423536-0.209517*i,+3.284449+0.000000*i]
logm (A)
Press return to continue.
------------------------------------
A :
+1.1223 +0.0000i +0.2365 +0.3122i -0.4972 +1.1169i
+0.2365 -0.3122i +0.9862 +0.0000i +0.4235 +0.2095i
-0.4972 -1.1169i +0.4235 -0.2095i +3.2844 +0.0000i
LogA_EValue :
+1.3727 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i -0.0065 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i -0.7904 +0.0000i
LogA
-0.3086 +0.0000i +0.2927 +0.2322i -0.3167 +0.6383i
+0.2927 -0.2322i -0.1222 +0.0000i +0.2126 +0.0191i
-0.3167 -0.6383i +0.2126 -0.0191i +1.0065 +0.0000i
Press return to continue.
------------------------------------
Copy/Past into the octave window.
LogA=[
-0.308591+0.000000*i,+0.292697+0.232246*i,-0.316749+0.638287*i;
+0.292697-0.232246*i,-0.122191+0.000000*i,+0.212557+0.019112*i;
-0.316749-0.638287*i,+0.212557-0.019112*i,+1.006507+0.000000*i]
expm (LogA)
Press return to continue.
------------------------------------
LogA :
-0.3086 +0.0000i +0.2927 +0.2322i -0.3167 +0.6383i
+0.2927 -0.2322i -0.1222 +0.0000i +0.2126 +0.0191i
-0.3167 -0.6383i +0.2126 -0.0191i +1.0065 +0.0000i
Exp_LogA_EValue :
+3.9459 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.4537 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.9935 +0.0000i
Exp_LogA = A
+1.1223 -0.0000i +0.2365 +0.3122i -0.4972 +1.1169i
+0.2365 -0.3122i +0.9862 -0.0000i +0.4235 +0.2095i
-0.4972 -1.1169i +0.4235 -0.2095i +3.2844 +0.0000i
Press return to continue.
------------------------------------
A :
+1.1223 +0.0000i +0.2365 +0.3122i -0.4972 +1.1169i
+0.2365 -0.3122i +0.9862 +0.0000i +0.4235 +0.2095i
-0.4972 -1.1169i +0.4235 -0.2095i +3.2844 +0.0000i
Exp_LogA = A
+1.1223 -0.0000i +0.2365 +0.3122i -0.4972 +1.1169i
+0.2365 -0.3122i +0.9862 -0.0000i +0.4235 +0.2095i
-0.4972 -1.1169i +0.4235 -0.2095i +3.2844 +0.0000i
Press return to continue
Press X to stop