Aller au contenu

Mathc initiation/a212

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)
{
 tvalue t;

  t.min   =       0.; /* a */
  t.max   =    2.*PI; /* b */ 
  t.step  =      0.1;  

 CTRL_splot p;

  p.xmin = -4;
  p.xmax =  4;             
  p.ymin = -4;
  p.ymax =  4;
  
 int         n = 2*100;
 double sector =    .4;
 
 clrscrn();
 printf(" The area A of the region bounded by the graph of\n\n");
 printf(" two polar equations r = f(t) and r = g(t) and   \n\n");
 printf(" the line  t = a and t = b is                    \n\n");
  printf("       / b                   / b             \n");
 printf("      |                     |                 \n");
 printf(" A =  |   1/2 f(t)^2 dt  -  |   1/2 g(t)^2 dt \n");
 printf("      |                     |                 \n");
 printf("     /   a                 /   a          \n\n\n");
 printf("\n");
 getchar();

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

      G_polarg(
              p,
              f,g,
              t
              );

 printf(" Draw the two functions\n\n");
 printf(" ... load \"a_main.plt\" ... with gnuplot.  \n\n");
 getchar();

 clrscrn();
 
 t.min   =    -PI/3.; /* a */
 t.max   =     PI/3.; /* b */ 
 t.step  =       0.1;  
  
 printf(" f : t-> %s\n\n", feq);
 printf(" g : t-> %s\n\n", geq);

 printf(" a :     %+.3f  \n", t.min);
 printf(" b :     %+.3f\n\n", t.max);
  
      G_polar_areag(
              p,
              f,g,
              t,
         sector
            );

 printf(" Draw a typical circular sector.\n\n");
 printf(" ... load \"a_main.plt\" ... with gnuplot.  \n\n");
 getchar();

 clrscrn();
 printf(" Express the area of the sector as :\n\n");
 printf(" f(t)               : %s\n",feq);
 printf(" g(t)               : %s\n",geq);
 printf(" angle              : dt\n\n");
 printf(" Area of the sector : 1/2 (%s)^2 - 1/2 (%s)^2  dt\n",feq,geq);
 printf(" \n\n");
 printf(" If we apply \n\n\n");
 printf("     / %.2f\n",t.max);
 printf("    |  \n");
 printf("    |  \n");
 printf("   /   %.2f\n\n\n",t.min);
 printf(" to  :  1/2*(%s)^2 - 1/2*(%s)^2 dt\n\n\n",feq,geq);
 getchar();

 clrscrn();
 printf(" We obtain the area of the region Rt.\n\n\n");

 printf("     / %.2f\n",t.max);
 printf("    |  \n");
 printf("    |     1./2.*(%s)^2 - 1/2*(%s)^2 dt = %.6f\n",
            feq,geq,simpson(SectorArea,t.min,t.max,n));
 printf("    |  \n");
 printf("   /   %.2f\n",t.min);

 stop();

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


Exemple de sortie écran :

 The area A of the region bounded by the graph of

 two polar equations r = f(t) and r = g(t) and   

 the line  t = a and t = b is                    

       / b                   / b             
      |                     |                 
 A =  |   1/2 f(t)^2 dt  -  |   1/2 g(t)^2 dt 
      |                     |                 
     /   a                 /   a


Two polar equations r = f(t) and r = g(t) with gnuplot

Exemple de sortie écran :

 f : t-> 2.+2.*cos(t)

 g : t-> 3

 Draw the two functions

 To see the graph, open the file "a_main.plt" with Gnuplot.


Two polar equations r = f(t) and r = g(t) with gnuplot

Exemple de sortie écran :

 f : t-> 2.+2.*cos(t)

 g : t-> 3

 a :     -1.047  
 b :     +1.047

 Draw a typical circular sector.

 To see the graph, open the file "a_main.plt" with Gnuplot.


Exemple de sortie écran :

 Express the area of the sector as :

 f(t)               : 2.+2.*cos(t)
 g(t)               : 3
 angle              : dt

 Area of the sector : 1/2 (2.+2.*cos(t))^2 - 1/2 (3)^2  dt
 

 If we apply 


     / 1.05
    |  
    |  
   /   -1.05


 to  :  1/2*(2.+2.*cos(t))^2 - 1/2*(3)^2 dt


Exemple de sortie écran :

 We obtain the area of the region Rt.


     / 1.05
    |  
    |     1./2.*(2.+2.*cos(t))^2 - 1/2*(3)^2 dt = 4.652636
    |  
   /   -1.05

 Press return to continue