Aller au contenu

Mathc complexes/c072e

Un livre de Wikilivres.


Application


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


c02e.c
/* ------------------------------------ */
/*  Save as :  c02e.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);

int c1 = C1;      
int c2 = take_c(C4);
 
  clrscrn();
  printf(" A:");
  p_mZ(A, S3,P0, S3,P0, C6);
  printf(" B:");
  c_mZ(A,B);
  p_mZ(swapC_mZ(B,c1,c2), S3,P0, S3,P0, C6);

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

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

  If B is the matrix that  results when  
  two columns (c[1],c[4]) are interchanged
  then :  det(B) = - det(A)



 det(A) = +5369+13167i 
 det(B) = -5369-13167i 
 Press return to continue
 Press X      to stop