Mathc initiation/Fichiers c : c44cd


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;

double    h =    H;

 clrscrn();
 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) sqrt(1+Df(x)**2) dx =  \n"
        "    (a\n\n");
        
  printf(" Or \n\n");

 printf("    (b\n"
        " int(   f(x) ds =\n"
        "    (a\n\n\n");
 stop();
  
  
 clrscrn();     
 printf(" With the function simpson(); : \n\n"
        "    (b\n"
        " int(  2 Pi f(x) sqrt( 1 + Df(x)**2 )* dx = %.2f\n"
        "    (a\n\n\n", simpson(SurfaceArea, a,b,n));
        
 printf(" With the function surfacearea_ds(); : \n\n"
        "    (b\n"
        " int(   f(x) ds = %.2f\n"
        "    (a\n\n\n", surfacearea_ds(f, a,b,n, h));       
  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) sqrt(1+Df(x)**2) dx =  
    (a

 Or 

    (b
 int(  f(x) ds =
    (a


 Press return to continue.


Exemple de sortie écran :

 With the function simpson(); : 

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


 With the function surfacearea_ds(); : 

    (b
 int(  f(x) ds = 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