Mathc complexes/c072f

Un livre de Wikilivres.


Application


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


c02f.c
/* ------------------------------------ */
/*  Save as :  c02f.c                   */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mZ(i_mZ(r,r),9.);
double **B =      i_mZ(r,r);

int r1 = R1;
int r2 = R3;

  clrscrn();
  printf(" A:");
  p_mZ(A, S3,P0, S3,P0, C6);
  printf(" B:");
  p_mZ(swapR_mZ(c_mZ(A,B),r1,r2), S3,P0, S3,P0, C6);

  printf("  If B is the matrix that  results when  \n");
  printf("  two rows (r[%d],r[%d]) are interchanged\n",r1,r2);
  printf("  then :  det(B) = - det(A)\n\n\n");
  
  printf("\n   det_Z(A) = ");  
  p_Z(det_Z(A), S1,P0, S1,P0);
    
  printf("\n   det_Z(B) = ");
  p_Z(det_Z(B), 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:
 -5 -1i  +8 -7i  +6 -5i  -5 +8i  +8 -3i 
 -3 -7i  +2 +4i  -1 -7i  -1 +2i  -1 +6i 
 -7 +8i  -3 +4i  +6 -9i  -3 +8i  -1 +6i 
 -3 +6i  +4 +2i  -1 -7i  +4 -5i  -5 +2i 
 -7 -5i  +6 +6i  -9 -7i  +4 -9i  +8 +2i 

 B:
 -7 +8i  -3 +4i  +6 -9i  -3 +8i  -1 +6i 
 -3 -7i  +2 +4i  -1 -7i  -1 +2i  -1 +6i 
 -5 -1i  +8 -7i  +6 -5i  -5 +8i  +8 -3i 
 -3 +6i  +4 +2i  -1 -7i  +4 -5i  -5 +2i 
 -7 -5i  +6 +6i  -9 -7i  +4 -9i  +8 +2i 

  If B is the matrix that  results when  
  two rows (r[1],r[3]) are interchanged
  then :  det(B) = - det(A)



   det_Z(A) = -210157-355133i 
   det_Z(B) = +210157+355133i 
 Press return to continue
 Press X      to stop