Aller au contenu

Mathc initiation/Fichiers c : c30cd

Un livre de Wikilivres.


Sommaire


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

c2d.c
/* --------------------------------- */
/* save as c2d.c                     */
/* --------------------------------- */
#include  "x_hfile.h"
#include       "fd.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) = %8.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) = %8.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 = 7/3  =  %.5f\n\n", feq, 7./3.);

 stop();

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


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

(sin(7*x))'/(3*x)' = 7*cos(7*x)/3 et lim x->0  7*cos(7*x)/3 = 7*cos(7*0)/3 = 7/3 = 2,33333
(sin(A*x))'/(B*x)' = A*cos(A*x)/B et lim x->0  A*cos(A*x)/B = A*cos(A*0)/B = A/B 


Exemple de sortie écran :

 Does lim x->0 sin(7*x)/(3*x) exist ?

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

Exemple de sortie écran :

 f : x-> sin(7*x)/(3*x)

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

 f(+1.0) =    0.219 || f(+0.10) = 2.147392 || f(+0.010) = 2.33142824
 f(+0.9) =    0.006 || f(+0.09) = 2.182018 || f(+0.009) = 2.33179014
 f(+0.8) =   -0.263 || f(+0.08) = 2.213276 || f(+0.008) = 2.33211397
 f(+0.7) =   -0.468 || f(+0.07) = 2.241076 || f(+0.007) = 2.33239972
 f(+0.6) =   -0.484 || f(+0.06) = 2.265336 || f(+0.006) = 2.33264739
 f(+0.5) =   -0.234 || f(+0.05) = 2.285985 || f(+0.005) = 2.33285697
 f(+0.4) =    0.279 || f(+0.04) = 2.302964 || f(+0.004) = 2.33302846
 f(+0.3) =    0.959 || f(+0.03) = 2.316221 || f(+0.003) = 2.33316184
 f(+0.2) =    1.642 || f(+0.02) = 2.325719 || f(+0.002) = 2.33325711
 f(+0.1) =    2.147 || f(+0.01) = 2.331428 || f(+0.001) = 2.33331428
 Press return to continue.


Exemple de sortie écran :

 f : x-> sin(7*x)/(3*x)

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

 f(-1.0) =    0.219 || f(-0.10) = 2.147392 || f(-0.010) = 2.33142824
 f(-0.9) =    0.006 || f(-0.09) = 2.182018 || f(-0.009) = 2.33179014
 f(-0.8) =   -0.263 || f(-0.08) = 2.213276 || f(-0.008) = 2.33211397
 f(-0.7) =   -0.468 || f(-0.07) = 2.241076 || f(-0.007) = 2.33239972
 f(-0.6) =   -0.484 || f(-0.06) = 2.265336 || f(-0.006) = 2.33264739
 f(-0.5) =   -0.234 || f(-0.05) = 2.285985 || f(-0.005) = 2.33285697
 f(-0.4) =    0.279 || f(-0.04) = 2.302964 || f(-0.004) = 2.33302846
 f(-0.3) =    0.959 || f(-0.03) = 2.316221 || f(-0.003) = 2.33316184
 f(-0.2) =    1.642 || f(-0.02) = 2.325719 || f(-0.002) = 2.33325711
 f(-0.1) =    2.147 || f(-0.01) = 2.331428 || f(-0.001) = 2.33331428
 Press return to continue.


Exemple de sortie écran :

 With the table we arrive at the following conjecture.

     lim x->0 sin(7*x)/(3*x) = 7/3  =  2.33333

 Press return to continue.