Aller au contenu

Mathc initiation/002a

Un livre de Wikilivres.


Sommaire

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

c00d.c
/* ---------------------------------- */
/* save as c00d.c                     */
/* ---------------------------------- */
#include "x_hfile.h"
#include      "fd.h"
/* ---------------------------------- */
int main(void)
{
int      n =   2*50;
double   a =    -1.;
double   b =    +1.;

 clrscrn();

 printf("An odd function with respect to x\n\n" 
 
        "    (%.3f                         \n"
        " int(      (%s) * dx = %.6f       \n"
        "    (%.3f                   \n\n\n\n",  
              b, feq, simpson(f,a,b,n), a);

 printf(" With the antiderivative of f.\n\n"
        " F(x) = %s                  \n\n\n" 
        " F(%.3f) -  F(%.3f)  = %.6f \n\n\n", Feq, b,a, F(b)-F(a));
 
 stop();

 return 0;
} 
/* ---------------------------------- */
/* ---------------------------------- */

Verifier avec mathematica : Free: wolframalpha.com

int (tan(x)) dx from -a to a

Exemple de sortie écran :

An odd function with respect to x

    (1.000                         
 int(      (tan(x)) * dx = 0.000000       
    (-1.000                   



 With the antiderivative of f.

 F(x) = - ln( |cos(x)| )                  


 F(1.000) -  F(-1.000)  = 0.000000 


 Press return to continue.