Mathc initiation/Fichiers c : c30ch

Un livre de Wikilivres.


Sommaire


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

c2h.c
/* --------------------------------- */
/* save as c2h.c                     */
/* --------------------------------- */
#include  "x_hfile.h"
#include       "fh.h"
/* --------------------------------- */
int main(void)
{
double i;

 clrscrn();
 printf(" Does lim x->0 %s exist ?\n\n", feq);
 printf(" Substituing 0 for x gives 0/0.\n");
 stop();


 clrscrn();
 printf(" f : x-> %s\n\n", feq);

 printf(" Approximate f(x) by the right,\n");
 printf(" for x near 0.\n\n");

 for(i=1; i>0.1; i+=-.1)
     printf(" f(%+.1f) = %5.3f || f(%+.2f) = %5.6f || f(%+.3f) = %5.8f\n",
     i,    f(i),
     i*.1, f(i*.1),
     i*.01,f(i*.01)
     );
 stop();


 clrscrn();
 printf(" f : x-> %s\n\n", feq);

 printf(" Approximate f(x) by the left,\n");
 printf(" for x near 0.\n\n");

 for(i=-1; i<-0.1; i+=.1)
     printf(" f(%+.1f) = %5.3f || f(%+.2f) = %5.6f || f(%+.3f) = %5.8f\n",
     i,    f(i),
     i*.1, f(i*.1),
     i*.01,f(i*.01)
     );
  stop();


 clrscrn();
 printf(" With the table we arrive at the following conjecture.\n\n");
 printf("     lim x->0 %s = 1\n\n", feq);
 stop();

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


On peut obtenir le même résultat en utilisant la Règle de L'Hôpital. [wikipedia].

                      1                    
                     ---                 
      (log(1+x))'    1+x     1                   1     
      ----------- =  ---  = ---    et  lim x->0 ---  =  1
           x'         1     1+x                 1+x 


 Remarque :
                         A                    
                       -----                
      (log(1+A*x))'    1+A*x                   A       1       A
      ------------- =  -----    et  lim x->0  -----   ---  =  ---
         (B*x)'          B                    1+A*x    B       B


Exemple de sortie écran :

 Does lim x->0 log(1+x)/x exist ?

 Substituing 0 for x gives 0/0.
 Press return to continue.  


****************************


 f : x-> log(1+x)/x

 Approximate f(x) by the right,
 for x near 0.

 f(+1.0) = 0.693 || f(+0.10) = 0.953102 || f(+0.010) = 0.99503309
 f(+0.9) = 0.713 || f(+0.09) = 0.957530 || f(+0.009) = 0.99552682
 f(+0.8) = 0.735 || f(+0.08) = 0.962013 || f(+0.008) = 0.99602121
 f(+0.7) = 0.758 || f(+0.07) = 0.966552 || f(+0.007) = 0.99651625
 f(+0.6) = 0.783 || f(+0.06) = 0.971148 || f(+0.006) = 0.99701195
 f(+0.5) = 0.811 || f(+0.05) = 0.975803 || f(+0.005) = 0.99750830
 f(+0.4) = 0.841 || f(+0.04) = 0.980518 || f(+0.004) = 0.99800532
 f(+0.3) = 0.875 || f(+0.03) = 0.985293 || f(+0.003) = 0.99850299
 f(+0.2) = 0.912 || f(+0.02) = 0.990131 || f(+0.002) = 0.99900133
 f(+0.1) = 0.953 || f(+0.01) = 0.995033 || f(+0.001) = 0.99950033
 Press return to continue. 


****************************


 f : x-> log(1+x)/x

 Approximate f(x) by the left,
 for x near 0.

 f(-1.0) =   inf || f(-0.10) = 1.053605 || f(-0.010) = 1.00503359
 f(-0.9) = 2.558 || f(-0.09) = 1.047896 || f(-0.009) = 1.00452718
 f(-0.8) = 2.012 || f(-0.08) = 1.042270 || f(-0.008) = 1.00402146
 f(-0.7) = 1.720 || f(-0.07) = 1.036724 || f(-0.007) = 1.00351642
 f(-0.6) = 1.527 || f(-0.06) = 1.031257 || f(-0.006) = 1.00301205
 f(-0.5) = 1.386 || f(-0.05) = 1.025866 || f(-0.005) = 1.00250836
 f(-0.4) = 1.277 || f(-0.04) = 1.020550 || f(-0.004) = 1.00200535
 f(-0.3) = 1.189 || f(-0.03) = 1.015307 || f(-0.003) = 1.00150301
 f(-0.2) = 1.116 || f(-0.02) = 1.010135 || f(-0.002) = 1.00100134
 f(-0.1) = 1.054 || f(-0.01) = 1.005034 || f(-0.001) = 1.00050033
 Press return to continue. 


****************************


 With the table we arrive at the following conjecture.

     lim x->0 log(1+x)/x = 1

 Press return to continue.