SommaireUtilise la commande "Retour en Arrière" de ton navigateur.


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


c01d.c
/* ------------------------------------ */
/*  Save as :   c01d.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define   RA R4
#define   CA C4
/* ------------------------------------ */
#define FACTOR_E        +1.E-0         
/* ------------------------------------ */
void fun(void)
{
double tA[RA*CA]={
/* x**0   x**1   x**2    x**3 */
   1,    -5.,   +25.,   -125.,
   1,    -2.,    +4.,     -8.,
   1,    +2.,    +4.,     +8.,
   1,    +3.,    +9.,    +27.
};

double tb[RA*C1]={
/*     y  */
   -3.00 ,
   +0.00,
   +3.00,
   -2.00,
};

double **A       = ca_A_mR(tA,i_mR(RA,CA));
double **b       = ca_A_mR(tb,i_mR(RA,C1));
double **Pinv    = i_mR(CA,RA);          
double **Pinvb   = i_mR(CA,C1);         

  clrscrn();
  printf(" Fitting a linear Curve to Data :\n\n");
  printf(" A :");
  p_mR(A,S10,P2,C7);
  printf(" b :");
  p_mR(b,S10,P2,C7);
   
  printf(" Pinv = V * invS_T * U_T ");
  Pinv_Rn_mR(A,Pinv,FACTOR_E); 
  pE_mR(Pinv,S12,P4,C10);    
  stop();
  
  clrscrn();   
  printf(" x = Pinv * b ");   
  mul_mR(Pinv,b,Pinvb); 
  p_mR(Pinvb,S10,P4,C10);
  printf(" The Cubic equation Curve to Data : \n\n"
         "  s = %+.3f %+.3f*t %+.3f*t**2 %+.3f*t**3\n\n"
            ,Pinvb[R1][C1],Pinvb[R2][C1],
             Pinvb[R3][C1],Pinvb[R4][C1]);         
  stop();  

  f_mR(b);     
  f_mR(A); 
  f_mR(Pinv);
  f_mR(Pinvb); 
}
/* ------------------------------------ */
int main(void)
{
  
  fun();

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



Exemple de sortie écran :
 -----------------------------------
 Fitting a linear Curve to Data :

 A :
     +1.00      -5.00     +25.00    -125.00 
     +1.00      -2.00      +4.00      -8.00 
     +1.00      +2.00      +4.00      +8.00 
     +1.00      +3.00      +9.00     +27.00 

 b :
     -3.00 
     +0.00 
     +3.00 
     -2.00 

 Pinv = V * invS_T * U_T 
   -0.0714    +0.5000    +1.0714    -0.5000 
   +0.0238    -0.3167    +0.3929    -0.1000 
   +0.0179    -0.0000    -0.1429    +0.1250 
   -0.0060    +0.0167    -0.0357    +0.0250 

 Press return to continue. 


 -----------------------------------
 x = Pinv * b 
   +4.4286 
   +1.3071 
   -0.7321 
   -0.1393 

 The Cubic equation Curve to Data : 

  s = +4.429 +1.307*t -0.732*t**2 -0.139*t**3

 Press return to continue.