Mathc complexes/a132
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : c00d.c */
double **Exp_mZ(
double **A,
double **ExpA
double **A_n = i_mZ(RCA,RCA);
double **sA = i_mZ(RCA,RCA);
double **NewExpA = i_mZ(RCA,RCA);
int n = 10; 
int i = 0; 
 for(i = 0; i <= n; i++)
 pow_mZ(i, A, A_n); 
 smul_mZ(1./factorial(i), A_n, sA); 
 add_mZ(ExpA,sA,NewExpA); 
 c_mZ(NewExpA,ExpA);

f_mZ(A_n);
 f_mZ(sA);
 f_mZ(NewExpA);
 return (ExpA); 
/* ------------------------------------ */
void fun(void)
double **A = i_mZ(RCA,RCA) ; 
double **B = i_mZ(RCA,RCA) ;
double **ExpA = i_mZ(RCA,RCA); 
double **ExpB = i_mZ(RCA,RCA); 
double **AplsB = i_mZ(RCA,RCA); 
double **ExpAplsB = i_mZ(RCA,RCA);
 r_commute2_mZ(A,B,9);
 add_mZ(A,B,AplsB);
 clrscrn(); 
 printf(" Copy/Past into the octave window. \n\n");
 p_Octave_mZ(A, "A", P12, P12);
 printf(" expm (A)\n\n");
 p_Octave_mZ(B, "B", P12, P12);
 printf(" expm (B)\n\n"); 
 stop();
 clrscrn(); 
 p_Octave_mZ(AplsB, "AplsB", P12, P12);
 printf(" expm (AplsB)\n\n");
 printf(" expm (A)*expm (B)\n"); 
 printf(" expm (B)*expm (A)\n\n"); 
 stop();
 clrscrn(); 
 Exp_mZ(A, ExpA);
 Exp_mZ(B, ExpB);
 Exp_mZ(AplsB, ExpAplsB);
 printf(" ExpA :");
 p_mZ(ExpA,S8,P6,S8,P6,C6);
 printf(" ExpB :");
 p_mZ(ExpB,S8,P6,S8,P6,C6);
 stop();
 clrscrn();
 printf(" ExpAplsB=:");
 p_mZ( ExpAplsB,S8,P6,S8,P6,C6); 
 printf(" ExpA * ExpB:");
 mul_mZ(ExpA,ExpB,A);
 p_mZ(A,S8,P6,S8,P6,C6); 
 printf(" ExpB * ExpA:");
 mul_mZ(ExpB,ExpA,A);
 p_mZ(A,S8,P6,S8,P6,C6); 
 f_mZ(A);
 f_mZ(ExpA);
 f_mZ(B);
 f_mZ(ExpB);
 f_mZ(AplsB);
 f_mZ(ExpAplsB); 
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
do
 fun();
} while(stop_w());
 return 0;
/* ------------------------------------ */
 ExpA = Ide + A + (1/2) A**2 + (1/6) A**3 + ... + 1/(n-1)! A**(n-1)
 Exemple de sortie écran :
 Copy/Past into the octave window. 
 A=[
-0.757-0.090*i,-0.012+0.864*i,+0.123+0.562*i;
-0.247-0.225*i,+0.054-0.504*i,+0.601-0.484*i;
+0.217-0.277*i,+0.610+1.058*i,-0.434+0.594*i]
 expm (A)
 B=[
-0.059-0.034*i,-0.004+0.324*i,+0.046+0.210*i;
-0.093-0.084*i,+0.245-0.189*i,+0.225-0.181*i;
+0.081-0.104*i,+0.229+0.396*i,+0.062+0.223*i]
 expm (B)
 Press return to continue. 
 ------------------------------------
 AplsB=[
-0.816-0.123*i,-0.016+1.187*i,+0.169+0.772*i;
-0.339-0.309*i,+0.300-0.693*i,+0.825-0.666*i;
+0.298-0.381*i,+0.839+1.455*i,-0.372+0.817*i]
 expm (AplsB)
 expm (A)*expm (B)
 expm (B)*expm (A)
 Press return to continue. 
 ------------------------------------
 ExpA :
+0.618709-0.095516i -0.012391+0.919091i +0.130450+0.597692i 
-0.262755-0.238964i +1.482159-0.536585i +0.638961-0.515155i 
+0.231006-0.294612i +0.649513+1.126009i +0.962539+0.632100i 
 ExpB :
+0.972568-0.041773i -0.005419+0.401962i +0.057052+0.261399i 
-0.114915-0.104510i +1.350196-0.234674i +0.279448-0.225302i 
+0.101030-0.128848i +0.284063+0.492457i +1.122941+0.276447i 
 Press return to continue. 
 ------------------------------------
 ExpAplsB=:
+0.785416-0.179487i -0.023285+1.727098i +0.245133+1.123145i 
-0.493753-0.449046i +2.407956-1.008317i +1.200695-0.968046i 
+0.434093-0.553616i +1.220525+2.115925i +1.431519+1.187804i 
 ExpA * ExpB:
+0.785416-0.179487i -0.023285+1.727099i +0.245133+1.123146i 
-0.493753-0.449046i +2.407957-1.008317i +1.200695-0.968047i 
+0.434093-0.553616i +1.220525+2.115926i +1.431519+1.187804i 
 ExpB * ExpA:
+0.785416-0.179487i -0.023285+1.727099i +0.245133+1.123146i 
-0.493753-0.449046i +2.407957-1.008317i +1.200695-0.968047i 
+0.434093-0.553616i +1.220525+2.115926i +1.431519+1.187804i 
 Press return to continue
 Press X to stop

Mathc complexes/a133
Bibliothèque
Installer ce fichier dans votre répertoire de travail.
/* Save as : wrm_com3.h */
double **Diag_sinh_mZ(
double **A,
double **sinA)
int r;
int c;
int i=0;
 m0_mZ(sinA);
 for (r=R1; r<A[R_SIZE][C0]; r++,i++)
 for (c=C1; c<A[C_SIZE][C0]; c+=C2)
 if((r+i)==c) sinA[r][c] = 10./sinh(A[r][c]);
 return(sinA);
/* ------------------------------------ */
double **Diag_cosh_mZ(
double **A,
double **cosA)
int r;
int c;
int i=0;
 m0_mZ(cosA);
 for (r=R1; r<A[R_SIZE][C0]; r++,i++)
 for (c=C1; c<A[C_SIZE][C0]; c+=C2)
 if((r+i)==c) cosA[r][c]=10./cosh(A[r][c]);
 return(cosA);
/* ------------------------------------ */
void r_commute3_mZ(
double **A,
double **B,
double **C,
int n
double **P; 
double **Pinv; 
double **D;
double **T;
double **Dt;
int r=rsize_Z(A);
 P = i_mZ(r,r);
 Pinv = i_mZ(r,r);
 D = i_mZ(r,r);
 T = i_mZ(r,r);
 Dt = i_mZ(r,r);
 r_mZ(P,n);
 rdiag_mZ(D,n);
 inv_mZ(P,Pinv);
 mul_mZ(P,Diag_sin_mZ(D,Dt),T);
 mul_mZ(T,Pinv,A);
 mul_mZ(P,Diag_cos_mZ(D,Dt),T);
 mul_mZ(T,Pinv,B);
 mul_mZ(P,Diag_sinh_mZ(D,Dt),T);
 mul_mZ(T,Pinv,C);
 f_mZ(P);
 f_mZ(Pinv);
 f_mZ(D);
 f_mZ(T);
 f_mZ(Dt);
/* ------------------------------------ */
 Déclaration des fichiers h.

Mathc complexes/a134
Bibliothèque
Installer ce fichier dans votre répertoire de travail.
/* ------------------------------------ */
/* Save as : wrm_com4.h */
void r_commute4_mZ(
double **A,
double **B,
double **C,
double **E,
int n
double **P; 
double **Pinv; 
double **D;
double **T;
double **Dt;
int r=rsize_Z(A);
 P = i_mZ(r,r);
 Pinv = i_mZ(r,r);
 D = i_mZ(r,r);
 T = i_mZ(r,r);
 Dt = i_mZ(r,r);
 r_mZ(P,n);
 rdiag_mZ(D,n);
 inv_mZ(P,Pinv);
 mul_mZ(P,Diag_sin_mZ(D,Dt),T);
 mul_mZ(T,Pinv,A);
 mul_mZ(P,Diag_cos_mZ(D,Dt),T);
 mul_mZ(T,Pinv,B);
 mul_mZ(P,Diag_sinh_mZ(D,Dt),T);
 mul_mZ(T,Pinv,C);
 mul_mZ(P,Diag_cosh_mZ(D,Dt),T);
 mul_mZ(T,Pinv,E);

f_mZ(P);
 f_mZ(Pinv);
 f_mZ(D);
 f_mZ(T);
 f_mZ(Dt);
/* ------------------------------------ */
 Déclaration des fichiers h.

Mathc complexes/a135
Application
Installer et compiler ces fichiers dans votre répertoire de travail.
/* Save as : c00a.c */
void AplsB(int r)
double **A = i_mZ(r,r);
double **B = i_mZ(r,r);
double **T = i_mZ(r,r);
double **AB = i_mZ(r,r);
double **BA = i_mZ(r,r);
 r_commute2_mZ(A,B,9);
 clrscrn();
 printf(" A : ");
 p_mZ(A,S5,P3,S5,P3,C6); 
 printf(" B : ");
 p_mZ(B,S5,P3,S5,P3,C6); 
 stop();
 clrscrn();
 printf(" AB : ");
 p_mZ(mul_mZ(A,B,AB),S5,P9,S5,P9,C6);
 printf(" BA : ");
 p_mZ(mul_mZ(B,A,BA),S5,P9,S5,P9,C6);
 f_mZ(A);
 f_mZ(B);
 f_mZ(T);
 f_mZ(AB);
 f_mZ(BA);
/* ------------------------------------ */
void hello(void)

printf("\n ");
 printf("\n Two commutative matrices ");
 printf("\n **************** \n");
 printf("\n ");
 printf("\n ");
 printf("\n \n");
 stop();
/* ------------------------------------ */
int main(void)
time_t t;
 srand(time(&t));
 hello();
do
 AplsB(RC3);
} while(stop_w());
 return 0;
/* ------------------------------------ */
Exemple de sortie écran :
 A : 
+0.021-0.058i -0.167+0.579i +0.291-0.035i 
-0.521-0.108i +0.819+0.311i +0.166+0.004i 
+0.359+0.889i +0.606-0.101i +0.798-0.252i 
 B : 
+0.796+0.032i +0.091-0.316i -0.159+0.019i 
+0.284+0.059i +0.360-0.170i -0.091-0.002i 
-0.196-0.485i -0.331+0.055i +0.371+0.138i 
 Press return to continue. 
 ---------------------------------------
 AB : 
-0.137204867-0.025416958i -0.072911473+0.252462463i +0.127060202-0.015377914i 
-0.227127280-0.046970730i +0.210983133+0.135546061i +0.072383946+0.001553184i 
+0.156671185+0.387661650i +0.264346514-0.044004928i +0.201956386-0.110129104i 
 BA : 
-0.137204867-0.025416958i -0.072911473+0.252462463i +0.127060202-0.015377914i 
-0.227127280-0.046970730i +0.210983133+0.135546061i +0.072383946+0.001553184i 
+0.156671185+0.387661650i +0.264346514-0.044004928i +0.201956386-0.110129104i 
 Press return to continue
 Press X to stop