Mathc initiation/Fichiers c : c42cb
La méthode des disques, est une méthode de calcul du volume d'un solide de révolution par intégration selon un axe «parallèle» à l'axe de révolution. [wikipedia]
Installer et compiler ces fichiers dans votre répertoire de travail.
c05b.c |
---|
/* ---------------------------------- */
/* save as c05b.c */
/* ---------------------------------- */
#include "x_hfile.h"
#include "fb.h"
/* ---------------------------------- */
int main(void)
{
int n = 2*10;
double a = (PI/2.);
double b = 4.;
clrscrn();
printf(" Compute the volume V of the solid of revolution \n");
printf(" generated by revolving R about the x-axis \n\n");
printf(" Draw the region R bounded by the graph of f, the x-axis,\n");
printf(" and the vertical lines x = a and x = b \n\n");
printf(" Let f be continous on [%.3f,%.3f].\n\n", a, b);
printf(" f : x-> %s\n\n", feq);
stop();
clrscrn();
printf(" Draw a typical vertical rectangle. \n\n");
printf(" The radius of the disk : %s \n", feq);
printf(" The thickness of the disk : dx\n");
printf(" The volume of the disk : Pi (%s)**2 dx \n\n\n", feq);
printf(" Volume of a Circular disk = Pi (radius)**2 (thickness)\n\n\n");
stop();
clrscrn();
printf(" If we apply \n\n\n");
printf(" (%.3f\n", b);
printf(" int( \n");
printf(" (%.3f\n\n\n", a);
printf(" to : Pi (%s)**2 dx\n\n\n", feq);
printf(" We obtain a limit of sums of volumes of disks.\n\n\n");
printf(" (%.3f\n", b);
printf(" int( Pi (%s)**2 dx = %.3f\n", feq, simpson(VCircularDisk,a,b,n));
printf(" (%.3f\n", a);
stop();
return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */
Exemple de sortie écran :
Compute the volume V of the solid of revolution
generated by revolving R about the x-axis
Draw the region R bounded by the graph of f, the x-axis,
and the vertical lines x = a and x = b
Let f be continous on [1.571,4.000].
f : x-> sin(x)
Press return to continue.
Dessinons avec gnuplot la fonction f :
set zeroaxis lt 8
set grid
plot [(pi/2.):4.000] [-1.000:1.000] sin(x)
reset
Exemple de sortie écran :
Draw a typical vertical rectangle.
The radius of the disk : sin(x)
The thickness of the disk : dx
The volume of the disk : Pi (sin(x))**2 dx
Volume of a Circular disk = Pi (radius)**2 (thickness)
Press return to continue.
Dessinons un rectangle pour construire l'équation du volume:
set zeroaxis lt 8
set grid
set object 3 rect from 2.,0 to 2.01,sin(2.01)
plot [(pi/2.):4.000] [-1.000:1.000] sin(x),\
-sin(x)
reset
Exemple de sortie écran :
If we apply
(4.000
int(
(1.571
to : Pi (sin(x))**2 dx
We obtain a limit of sums of volumes of disks.
(4.000
int( Pi (sin(x))**2 dx = 3.039
(1.571
Press return to continue.
Vérifier le résultat avec Octave 5.2 : I = quad (f, a, b)
>> I = quad (@(x) pi*(sin(x).*sin(x)),(pi/2.),4)
I = 3.0387