Aller au contenu

Mathc matrices/c20x

Un livre de Wikilivres.


Application


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


c00e.c
/* ------------------------------------ */
/*  Save as :   c00e.c                  */
/* ------------------------------------ */
#include    "v_a.h"
#include "dot_trac.h"
/* ------------------------------------ */
void fun(void)
{
double a[R2*C2]={ 1,2,
                  3,4};	
double b[R2*C2]={-1,0,
                  3,2};
                  
double **A = ca_A_mR(a,i_mR(R2,C2));
double **B = ca_A_mR(b,i_mR(R2,C2));  

double **AmnsB = sub_mR(A,B,i_mR(R2,C2));

  clrscrn();
  printf(" A :");
  p_mR(A,S3,P0,C6);
  printf(" B :");
  p_mR(B,S3,P0,C6);
 
  sub_mR(A,B,AmnsB);
  
  printf("  d(A,B) = ||u-v||^(1/2)  \n\n");
  printf("  d(A,B) = %.4f   norm_TR_R(AmnsB)\n\n",norm_TR_R(AmnsB));
  printf("  d(A,B) = %.4f   dist_TR_R(A,B)\n",    dist_TR_R(A,B));
  printf("  d(B,A) = %.4f   dist_TR_R(B,A)\n\n",  dist_TR_R(B,A));

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

  fun();
  
  stop();

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



Exemple de sortie écran :
 ------------------------------------ 
 A :
 +1  +2 
 +3  +4 

 B :
 -1  +0 
 +3  +2 

  d(A,B) = ||u-v||^(1/2)  

  d(A,B) = 3.4641   norm_TR_R(AmnsB)

  d(A,B) = 3.4641   dist_TR_R(A,B)
  d(B,A) = 3.4641   dist_TR_R(B,A)

 Press return to continue.