Aller au contenu

Mathc complexes/a238

Un livre de Wikilivres.


Application


Installer et compiler ces fichiers dans votre répertoire de travail.


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h" 
/* ------------------------------------ */
/* ------------------------------------ */
#define   RCQ RC3
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **Q = r_Q_mZ(i_mZ(RCQ,RCQ), 9);

double **u[RCQ];
int c,c2;

/* ------------------------------------ */
/* ------------------------------------ */
  for(c=C0; c<csize_Z(Q); c++)
     {
      u[c] = i_mZ(RCQ,C1);      
      c_c_mZ(Q,(c+C1),u[c],C1); }
      
/* ------------------------------------ */
/* ------------------------------------ */     
  clrscrn();
  
  printf(" Orthonormal bases :\n\n");
 
  for(c=C0; c<csize_Z(Q); c++)
     {
	  printf(" u[%d] :",c);      
      p_mZ(u[c],S5,P4,S5,P4,C6); 
     } 
   stop();

/* ------------------------------------ */
/* ------------------------------------ */   
  clrscrn();

  printf("   <u,u>        = ||u||^2\n"
         "  (<u,u>)^(1/2) = ||u||  \n\n");
          
  for(c=C0; c<csize_Z(Q); c++)

	  printf(" ||u[%d]|| = %.4f :\n",c,norm_Z(u[c]));      
 
     
  printf(" \n\n\n"
         "      <u,v> = v^t u\n\n");

  for(c=C0; c<csize_Z(Q); c++) 
  
    for(c2=C0; c2<csize_Z(Q); c2++) 
    
      if(c!=c2)     
         {
        printf(" <u[%d],u[%d]> = ",c,c2);
       	p_Z(dot_Z(u[c],u[c2]),S3,P0,S3,P0); 
        printf("\n");  }

/* ------------------------------------ */
/* ------------------------------------ */
  for(c=C0; c<csize_Z(Q); c++)
  
       f_mZ(u[c]); 
        
  f_mZ(Q);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}

/* ------------------------------------ */
/* ------------------------------------ */


Exemple de sortie écran :
 ------------------------------------ 
 Orthonormal bases :

 u[0] :
-0.2808-0.4493i 
-0.4493-0.4493i 
+0.4493-0.3370i 

 u[1] :
+0.3100-0.0535i 
+0.0210+0.6517i 
+0.6582-0.2063i 

 u[2] :
-0.0936+0.7820i 
+0.2059-0.3586i 
+0.3739-0.2625i 

 Press return to continue. 


 ------------------------------------ 
   <u,u>        = ||u||^2
  (<u,u>)^(1/2) = ||u||  

 ||u[0]|| = 1.0000 :
 ||u[1]|| = 1.0000 :
 ||u[2]|| = 1.0000 :
 


      <u,v> = v^t u

 <u[0],u[1]> =  +0 +0i 
 <u[0],u[2]> =  +0 -0i 
 <u[1],u[0]> =  +0 -0i 
 <u[1],u[2]> =  -0 -0i 
 <u[2],u[0]> =  +0 +0i 
 <u[2],u[1]> =  -0 +0i 

 Press   return to continue
 Press X return to stop