Aller au contenu

Mathc complexes/a275

Un livre de Wikilivres.


Le code de la fonction :

/* ------------------------------------ */
/* ------------------------------------ */
void pAi_Octave_mZ(
double  **A,
char name[],
int i,
int Pr,
int Pi
)
{
 int r;
 int c;

 printf(" %s%d=[\n",name,i);

 for(r=R1; r<A[R_SIZE][C0]; r++)
  {
  for(c=C1; c<A[C_SIZE][C0]; c+=C2)
 
     printf("%+.*f%+.*f*i,",Pr,A[r][c], Pi,A[r][c+C1]);

   if((r+1)<A[R_SIZE][C0]) printf("\b;\n");

   else                    printf("\b]\n\n");
  }
}
/* ------------------------------------ */
/* ------------------------------------ */
On travail sur un tableau de matrices. Cette fonction permet d'imprimer l'indice (i) de la matrice. (0,1,...)

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define ARRAY A5
/* ------------------------------------ */
#define RCA   RC4
/* ------------------------------------ */
void fun(void)
{
int i;

double **A[ARRAY];  
                      
  for(i = A0; i < ARRAY; i++)
     { 
	   clrscrn();	
	    
       A[i] = rE_mZ(i_mZ(RCA,RCA),999,+1.E-3);
    
       printf(" Copy/Paste into the octave window.       \n\n");
       pAi_Octave_mZ(A[i], "A",i, P3, P3);
       printf(" expm (A%d)\n\n\n",i);
       
       if(i<ARRAY-A1) stop();
      }  

  for(i = A0; i < ARRAY; i++)
  
      f_mZ(A[i]);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun();
    
} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Exemple de sortie écran :

 Copy/Paste into the octave window.       

 A0=[
-0.083+0.756*i,+0.108-0.534*i,-0.992+0.659*i,-0.922-0.870*i;
+0.474+0.912*i,+0.015+0.363*i,-0.062+0.498*i,-0.363-0.684*i;
+0.433+0.645*i,-0.418+0.078*i,-0.130+0.155*i,+0.186+0.502*i;
+0.493-0.777*i,-0.436+0.203*i,+0.608+0.134*i,+0.556+0.853*i]

 expm (A0)


 Press return to continue. 


 Copy/Paste into the octave window.       

 A1=[
+0.975+0.966*i,+0.832-0.521*i,+0.218+0.450*i,+0.856+0.500*i;
+0.803+0.574*i,+0.135-0.455*i,+0.914-0.150*i,-0.124+0.895*i;
+0.656+0.210*i,+0.344-0.886*i,+0.561-0.683*i,-0.725-0.766*i;
-0.178+0.486*i,-0.554+0.491*i,+0.247-0.656*i,-0.799-0.187*i]

 expm (A1)


 Press return to continue. 


 Copy/Paste into the octave window.       

 A2=[
-0.851-0.662*i,-0.282-0.474*i,+0.322-0.260*i,+0.776+0.012*i;
+0.804+0.702*i,-0.874+0.264*i,+0.271+0.209*i,+0.190+0.243*i;
-0.946+0.953*i,+0.890-0.071*i,+0.303+0.414*i,+0.793-0.751*i;
-0.360+0.393*i,-0.365+0.792*i,+0.294-0.423*i,+0.833+0.961*i]

 expm (A2)



 Press   return to continue
 Press X return to stop