Mathc complexes/a120
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 **ExpA_EValue;
double **ExpA;
double **Log_ExpA_EValue;
double **Log_ExpA;
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(" expm (A)\n\n\n");
stop();
clrscrn();
ExpA_EValue = i_mZ(RCA,RCA);
ExpA = 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(exp,EValue, ExpA_EValue);
printf(" ExpA_EValue :");
p_mZ( ExpA_EValue, S9,P4, S9,P4, C6);
/* ExpA = V * ExpA_EValue * V_T*/
mul_mZ(V,ExpA_EValue,T);
mul_mZ(T,V_T,ExpA);
printf(" ExpA");
p_mZ(ExpA, S9,P4, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" Copy/Past into the octave window. \n\n");
p_Octave_mZ(ExpA,"ExpA", P6, P6);
printf(" logm (ExpA)\n\n\n");
stop();
clrscrn();
Log_ExpA_EValue = i_mZ(RCA,RCA);
Log_ExpA = i_mZ(RCA,RCA);
printf(" ExpA :");
p_mZ(ExpA, S9,P4, S9,P4, C6);
eigs_V_mZ(ExpA,V,FACTOR_E);
ctranspose_mZ(V,V_T);
/* ExpA_EValue = V_T * ExpA * V */
mul_mZ(V_T,ExpA,T);
mul_mZ(T,V,ExpA_EValue);
f_eigs_mZ(log,ExpA_EValue, Log_ExpA_EValue);
printf(" Log_ExpA_EValue :");
p_mZ( Log_ExpA_EValue, S9,P4, S9,P4, C6);
/* Log_ExpA = V * Log_ExpA_EValue * V_T*/
mul_mZ(V,Log_ExpA_EValue,T);
mul_mZ(T,V_T,Log_ExpA);
printf(" Log_ExpA = A");
p_mZ(Log_ExpA, S9,P4, S9,P4, C6);
stop();
/* ================================================================== */
clrscrn();
printf(" A :");
p_mZ(A, S9,P4, S9,P4, C6);
printf(" Log_ExpA = A");
p_mZ(Log_ExpA, S9,P4, S9,P4, C6);
f_mZ(A);
f_mZ(ExpA_EValue);
f_mZ(ExpA);
f_mZ(Log_ExpA_EValue);
f_mZ(Log_ExpA);
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;
}
/* ------------------------------------ */
/* ------------------------------------ */
Log( Exp(A) ) = A
Exemple de sortie écran :
------------------------------------
Copy/Past into the octave window.
A=[
+2.879524+0.000000*i,+2.303478+0.316380*i,-0.419476+1.635955*i;
+2.303478-0.316380*i,+2.968922+0.000000*i,+0.354841+1.226948*i;
-0.419476-1.635955*i,+0.354841-1.226948*i,+2.234330+0.000000*i]
expm (A)
Press return to continue.
------------------------------------
A :
+2.8795 +0.0000i +2.3035 +0.3164i -0.4195 +1.6360i
+2.3035 -0.3164i +2.9689 +0.0000i +0.3548 +1.2269i
-0.4195 -1.6360i +0.3548 -1.2269i +2.2343 +0.0000i
ExpA_EValue :
+544.4090 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +4.2213 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +1.4091 +0.0000i
ExpA
+225.0312 +0.0000i +210.5062 +44.2254i -18.7225+157.1044i
+210.5062 -44.2254i +209.6263 -0.0000i +14.8551+150.7684i
-18.7225-157.1044i +14.8551-150.7684i +115.3819 +0.0000i
Press return to continue.
------------------------------------
Copy/Past into the octave window.
ExpA=[
+225.031159+0.000000*i,+210.506217+44.225435*i,-18.722491+157.104370*i;
+210.506217-44.225435*i,+209.626282-0.000000*i,+14.855123+150.768440*i;
-18.722491-157.104370*i,+14.855123-150.768440*i,+115.381893+0.000000*i]
logm (ExpA)
Press return to continue.
------------------------------------
ExpA :
+225.0312 +0.0000i +210.5062 +44.2254i -18.7225+157.1044i
+210.5062 -44.2254i +209.6263 -0.0000i +14.8551+150.7684i
-18.7225-157.1044i +14.8551-150.7684i +115.3819 +0.0000i
Log_ExpA_EValue :
+6.2997 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +1.4401 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.3429 +0.0000i
Log_ExpA = A
+2.8795 -0.0000i +2.3035 +0.3164i -0.4195 +1.6360i
+2.3035 -0.3164i +2.9689 -0.0000i +0.3548 +1.2269i
-0.4195 -1.6360i +0.3548 -1.2269i +2.2343 +0.0000i
Press return to continue.
------------------------------------
A :
+2.8795 +0.0000i +2.3035 +0.3164i -0.4195 +1.6360i
+2.3035 -0.3164i +2.9689 +0.0000i +0.3548 +1.2269i
-0.4195 -1.6360i +0.3548 -1.2269i +2.2343 +0.0000i
Log_ExpA = A
+2.8795 -0.0000i +2.3035 +0.3164i -0.4195 +1.6360i
+2.3035 -0.3164i +2.9689 -0.0000i +0.3548 +1.2269i
-0.4195 -1.6360i +0.3548 -1.2269i +2.2343 +0.0000i
Press return to continue
Press X to stop