Mathc initiation/a301

Un livre de Wikilivres.


Sommaire


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

c00a.c
/* --------------------------------- */
/* save as c00a.c                    */
/* --------------------------------- */
#include  "x_hfile.h"
#include       "fa.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot w = i_ctrl_splot(0,1,0,1, 0,0, 0,0, 0,0);
pt2d       d =       i_pt2d(0.02,0.02);
      
double step =   .01;
 
 clrscrn();
 
 printf(" Verify that v(x) >= u(x) on [%.3f,%.3f].\n\n\n", ax, bx);

 printf(" v : x-> %s  \n", veq);
 printf(" u : x-> %s\n\n", ueq);

      G_f_ab(w,
             ax,bx,
             veq,v,
             ueq,u);
 stop();

 clrscrn();
 printf(" Draw a typical rectangle of dimensions dx and dy.\n\n");
 
       G_dxdy(w,
              ax,bx,
              d,
              step,
              v,u);
 stop();

 clrscrn();
 printf(" Holding x fixed, regard.\n\n");
 printf("      (%s  \n", veq);
 printf("   int(         \n");
 printf("      (%s\n\n", ueq);
 printf(" as an operator that sums the area elements      \n");
 printf(" dy dx in the same direction as the y axis,      \n");
 printf(" from the lower boundary to the upper boundary.\n\n");
 printf(" The expression\n\n");
 printf("       (%s\n",        veq);
 printf("  [ int(         dy ] dx\n");
 printf("       (%s\n\n",      ueq);
 printf(" represents the area of the vertical rectangle.\n\n\n");
 
         G_r(w,
             ax,bx,
             d,
             step,
             v,u);
 stop();

 clrscrn();
 printf(" Apply the operator\n\n");
 printf("    (%.3f  \n", bx);
 printf(" int(      \n"   );
 printf("    (%.3f\n\n", ax);
 printf(" to\n\n");
 printf("       (%s\n",          veq);
 printf("  [ int(       %s  dy ] dx\n", feq);
 printf("       (%s\n\n",        ueq);
 printf(" thereby taking a limit of sums of areas of \n");
 printf(" the vertical rectangles from ax = %.3f to bx = %.3f\n\n\n", 
                              ax,bx);
 stop();

 clrscrn();

 printf(" With the simpsonal's rule.\n\n\n");
 printf("         (%.3f  (%s\n",     bx, veq);
 printf(" A = int(    int(      %s   dy dx = %.6f\n", feq, 
                                     simpson_dydx(f, u,v,LOOP, ax,bx,LOOP));
 printf("         (%.3f  (%s\n\n\n", ax, ueq);

 stop();

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


Exemple de sortie écran :

 With the simpsonal's rule.


         (0.800  (sqrt(x)
 A = int(    int(      1   dy dx = 0.249399
         (0.200  (x**2


 Press return to continue.