Mathc initiation/Fichiers c : c41cc
Apparence
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.
c05a.c |
---|
/* ---------------------------------- */
/* save as c05c.c */
/* ---------------------------------- */
#include "x_hfile.h"
#include "fc.h"
/* ---------------------------------- */
int main(void)
{
int n = 2*10;
double a = 0.;
double b = .8;
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, \n");
printf(" the graph of g, and the vertical lines x = a and x = b\n\n");
printf(" Let f and g be continous on [%.3f,%.3f].\n\n", a, b);
printf(" f : x-> %s\n", feq);
printf(" g : x-> %s\n\n", geq);
stop();
clrscrn();
printf(" Draw a typical vertical rectangle. \n\n");
printf(" The thickness of washer : dx\n\n");
printf(" The outer radius : %s \n",feq);
printf(" The inner radius : %s \n\n",geq);
printf(" The volume : Pi [(%s)**2 - (%s)**2] dx\n\n", feq, geq);
printf(" Volume of a washer = Pi [(outer radius)**2 - (inner radius)**2] (thickness)");
printf(" \n\n\n");
stop();
clrscrn();
printf(" If we apply \n\n");
printf(" (%.3f\n", b);
printf(" int( \n");
printf(" (%.3f\n\n", a);
printf(" to : Pi [(%s)**2 - (%s)**2] dx\n\n", feq, geq);
printf(" We obtain a limit of sums of volumes of washers.\n\n");
printf(" (%.3f\n", b);
printf(" int( Pi[(%s)**2 - (%s)**2] dx = %.3f\n", feq, geq, simpson(Vwasher,a,b,n));
printf(" (%.3f\n\n\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 graph of g, and the vertical lines x = a and x = b
Let f and g be continous on [0.000,0.800].
f : x-> sin(x)
g : x-> x**2
Press return to continue.
Dessinons avec gnuplot les deux fonctions f et g :
set zeroaxis lt 8
set grid
plot [0.000:0.800] [-0.800:0.800] sin(x),\
x**2.
reset
Exemple de sortie écran :
Draw a typical vertical rectangle.
The thickness of washer : dx
The outer radius : sin(x)
The inner radius : x**2
The volume : Pi [(sin(x))**2 - (x**2)**2] dx
Volume of a washer = Pi [(outer radius)**2 - (inner 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 0.5,0.5**2. to 0.52,sin(0.52)
plot [0.000:0.800] [-0.800:0.800] sin(x),\
x**2.
reset
Exemple de sortie écran :
If we apply
(0.800
int(
(0.000
to : Pi [(sin(x))**2 - (x**2)**2] dx
We obtain a limit of sums of volumes of washers.
(0.800
int( Pi[(sin(x))**2 - (x**2)**2] dx = 0.266
(0.000
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))-(x**2).*(x**2)),0,.8)
I = 0.26569