Mathc matrices/c17c

Un livre de Wikilivres.


Application


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


c00b.c
/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RA R4
#define   CA C4
/* ------------------------------------ */
void fun(void)
{
double a[RA*CA]={
    +964,     -689,     +474,     +948,   
    +640,     -693,     -937,     +656,    
    -981,     -337,     -287,     +420,    
    -807,     -123,     +404,     -177 
};

double **A   = ca_A_mR(a,i_mR(RA,CA));
double **Inv =           i_mR(RA,CA);

  clrscrn();
  printf(" A\n");
  p_mR(A,S8,P0,C6);
  stop();

  clrscrn();
  printf(" invgj_mR(A,invA); gauss jordan (AId)\n");
  pE_mR(invgj_mR(A,Inv),S12,P4,C6);
  printf(" inv_mR(A,Inv);  det,...,adjoint,... \n");
  pE_mR(inv_mR(A,Inv),S12,P4,C6);
  stop();

  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mR(A,"A",P0);
  printf(" inv(A)\n");
  pE_mR(Inv,S12,P4,C6);
  stop();

  f_mR(Inv);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
   fun();

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
 -------------------------------
 A

    +964     -689     +474     +948 
    +640     -693     -937     +656 
    -981     -337     -287     +420 
    -807     -123     +404     -177 

 Press return to continue. 


 -------------------------------
 invgj_mR(A,invA); gauss jordan (AId)

 +1.2297e-04  +2.2103e-04  -6.6735e-04  -1.0573e-04 
 +1.2798e-05  -1.5789e-03  +1.2669e-03  -2.7770e-03 
 +5.4220e-04  -5.2536e-04  -2.0227e-04  +4.7693e-04 
 +6.6800e-04  -1.1096e-03  +1.7006e-03  -2.1493e-03 

 inv_mR(A,Inv);  det,...,adjoint,... 

 +1.2297e-04  +2.2103e-04  -6.6735e-04  -1.0573e-04 
 +1.2798e-05  -1.5789e-03  +1.2669e-03  -2.7770e-03 
 +5.4220e-04  -5.2536e-04  -2.0227e-04  +4.7693e-04 
 +6.6800e-04  -1.1096e-03  +1.7006e-03  -2.1493e-03 

 Press return to continue. 

 -------------------------------
 Copy/Past into the octave window.

 A=[
+964,-689,+474,+948;
+640,-693,-937,+656;
-981,-337,-287,+420;
-807,-123,+404,-177]

 inv(A)

 +1.2297e-04  +2.2103e-04  -6.6735e-04  -1.0573e-04 
 +1.2798e-05  -1.5789e-03  +1.2669e-03  -2.7770e-03 
 +5.4220e-04  -5.2536e-04  -2.0227e-04  +4.7693e-04 
 +6.6800e-04  -1.1096e-03  +1.7006e-03  -2.1493e-03