Aller au contenu

Mathc complexes/c072c

Un livre de Wikilivres.


Application


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


c02c.c
/* ------------------------------------ */
/*  Save as :  c02c.c                   */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
int take_c(int c)
{
int r = c;

     if(r!=C1) r= (c-C1)*C2+C1;

return(r);
}
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mZ(i_mZ(r,r),9.);
double **B =      i_mZ(r,r);

nb_Z z = {2,-3};

int c = take_c(C2);

  clrscrn();
  printf(" A:");
  p_mZ(A, S3,P0, S3,P0, C6);
  
  printf(" The column[%d] of A is muliply by ",((c-C1)/C2)+C1);
  p_Z(z, S1,P0, S1,P0);
  
  printf("\n B:");
  c_mZ(A,B);
  mulC_mZ(B,z,c);
  p_mZ(B , S3,P0, S3,P0, C6);
 
  printf("  If B is the matrix that  results when \n");
  printf("  a single column of A is muliplied by  \n");
  printf("  a scalar z, then det(B) = z det(A)\n\n");
  printf("   det_Z(B) =");
  p_Z(det_Z(B), S1,P0, S1,P0);
  
  printf("\n z*det_Z(A) =");
  p_Z(mul_Z(z,det_Z(A)), S1,P0, S1,P0);
    
  printf("\n   det_Z(A) = ");
  p_Z(det_Z(A), S1,P0, S1,P0);

  f_mZ(A);
  f_mZ(B);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
do
{
  fun(rp_I(RC2)+RC3);
  
} while(stop_w());

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




Exemple de sortie écran :
 A:
 +8 +2i  +8 +2i  -7 -5i  -1 -7i 
 -3 +8i  -5 -3i  +2 -1i  -3 -5i 
 -9 +4i  +8 +6i  +6 -1i  +4 -7i 
 +2 -5i  -3 -7i  +4 +4i  +4 +2i 

 The column[2] of A is muliply by +2-3i 
 B:
 +8 +2i +22-20i  -7 -5i  -1 -7i 
 -3 +8i -19 +9i  +2 -1i  -3 -5i 
 -9 +4i +34-12i  +6 -1i  +4 -7i 
 +2 -5i -27 -5i  +4 +4i  +4 +2i 

  If B is the matrix that  results when 
  a single column of A is muliplied by  
  a scalar z, then det(B) = z det(A)

   det_Z(B) =-22018-40514i 
 z*det_Z(A) =-22018-40514i 
   det_Z(A) = +5962-11314i 
 Press return to continue
 Press X      to stop