Mathc initiation/a213
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "x_hfile.h"
#include "fb.h"
/* ------------------------------------ */
int main(void)
{
tvalue t;
t.min = 0.; /* a */
t.max = 2.*PI; /* b */
t.step = 0.05;
CTRL_splot p;
p.xmin = -4;
p.xmax = 4;
p.ymin = -4;
p.ymax = 4;
int n = 2*100;
double sector = .1;
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 = 0.; /* a */
t.max = PI/6.; /* b */
t.step = 0.05;
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(" / %.3f\n",t.max);
printf(" | \n");
printf(" | \n");
printf(" / %.3f\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(" / %.3f\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(" / %.3f\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
Exemple de sortie écran :
f : t-> 4.*cos(2.*t)
g : t-> 2
Draw the two functions
To see the graph, open the file "a_main.plt" with Gnuplot.
Exemple de sortie écran :
f : t-> 4.*cos(2.*t)
g : t-> 2
a : +0.000
b : +0.524
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) : 4.*cos(2.*t)
g(t) : 2
angle : dt
Area of the sector : 1/2 (4.*cos(2.*t))^2 - 1/2 (2)^2 dt
If we apply
/ 0.524
|
|
/ 0.000
to : 1/2*(4.*cos(2.*t))^2 - 1/2*(2)^2 dt
Exemple de sortie écran :
We obtain the area of the region Rt.
/ 0.524
|
| 1./2.*(4.*cos(2.*t))^2 - 1/2*(2)^2 dt = 1.913223
|
/ 0.000
Press return to continue