« Mathc initiation/Fichiers c : c40cd » : différence entre les versions

Contenu supprimé Contenu ajouté
petit correction
(Aucune différence)

Version du 28 juillet 2021 à 14:24


Sommaire


En mathématiques, une surface de révolution est une surface de ℝ³, invariante par rotation autour d'un axe fixe. Une surface balayée par la rotation d'une courbe quelconque autour d'un axe fixe est une surface de révolution. [wikipedia]


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

c05d.c
/* ---------------------------------- */
/* save as c05d.c                   */
/* ---------------------------------- */
#include "x_hfile.h"
#include      "fd.h"
/* ---------------------------------- */
int main(void)
{
double    a =   .5;
double    b =   2.;
double    n = 2*10;

 printf(" Let f be smooth on [%.3f,%.3f] and f(x) >0.\n\n", a, b);
 printf("  f : x-> %s\n", feq);
 printf(" Df : x-> %s\n\n", Dfeq);
 printf(" a = %.2f;\n b = %.2f;\n\n", a,b); 

 printf(" The area S of the surface generated by revolving\n");
 printf(" the graph of f about the x-axis is :\n\n");

 printf("    (b\n"
        " int(  2 Pi f(x) ds =  with ds = sqrt(1+Df(x)**2) dx\n"
        "    (a\n\n\n");
        
 printf("    (b\n"
        " int(  2 Pi f(x) sqrt( 1 + Df(x)**2 )* dx = %.2f\n"
        "    (a\n\n\n", simpson(SurfaceArea,a,b,n));

  stop();
 return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */


Résultat dans gnuplot
The area S of the surface generated by revolving the graph of f about the x-axis


Exemple de sortie écran :

 Let f be smooth on [0.500,2.000] and f(x) >0.

  f : x-> exp(x)
 Df : x-> exp(x)

 a = 0.50;
 b = 2.00;

 The area S of the surface generated by revolving
 the graph of f about the x-axis is :

    (b
 int(  2 Pi f(x) ds =  with ds = sqrt(1+Df(x)**2) dx
    (a


    (b
 int(  2 Pi f(x) sqrt( 1 + Df(x)**2 )* dx = 167.57
    (a


 Press return to continue.
Vérifier le résultat avec Octave 5.2 :

I = quad (f, a, b) 
>> I = quad (@(x) 2*pi*exp(x).*(sqrt(1+(exp(x).*exp(x)))),.5,2)
I =  167.57