Aller au contenu

Mathc matrices/c072c

Un livre de Wikilivres.


Application


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


c02c.c
/* ------------------------------------ */
/*  Save as :  c02c.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR(i_mR(r,r),9.);
double **B =      i_mR(r,r);

double s = 2;

int    c = rp_I(A[C_SIZE][C0]-C1);

  clrscrn();
  printf(" A:");
  p_mR(A,S3,P0,C6);
  printf(" The column[%d] of A is muliply by (%+.3f):\n",c,s);
  printf(" B:");
  p_mR( mulC_mR(c_mR(A,B),s,c),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 s, then det(B) = s det(A)  \n\n");
  printf("   det_R(B) = %+.0f\n",    det_R(B));
  printf(" s*det_R(A) = %+.0f\n",  s*det_R(A));
  printf("   det_R(A) = %+.0f\n",    det_R(A));

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

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

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




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

 The column[3] of A is muliply by (+2.000):
 B:
 +8  -9 +12  -3 
 -7  +8  -6  -5 
 -5  -5  +8  -7 
 -3  -1  -6  +8 

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

   det_R(B) = -988
 s*det_R(A) = -988
   det_R(A) = -494

 Press return to continue
 Press X      to stop