Mathc initiation/Fichiers c : c72c03
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c01c.c |
---|
/* ---------------------------------- */
/* save as c1c.c */
/* ---------------------------------- */
#include "x_hfile.h"
#include "fc.h"
/* ---------------------------------- */
int main(void)
{
int n = 2*50;
double a = 1.;
double b = 3.;
clrscrn();
printf(" With the Simpson's rule. (n = %d)\n\n"
" (%.3f\n"
" int( (%s) dx = %.6f\n"
" (%.3f\n\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;
}
/* ---------------------------------- */
Calculons l'intégrale avec la fonction simpson(f,a,b,n); puis avec sa primitive F(x).
Exemple de sortie écran :
With the Simpson's rule. (n = 100)
(3.000
int( ((x**3) * (x**2+5)**(1/2)) dx = 66.226202
(1.000
With the antiderivative of f.
F(x) = (1/5)*pow((pow(x,2)+5),5/2) - (5/3)*pow((pow(x,2)+5),3/2)
F(3.000) - F(1.000) = 66.226202
Press return to continue.
Calculons la primitive :
Calculer la primitive de
/
| x**3 * sqrt(x**2+5) dx =
/
_____________________ _________________
| u = (x**2+5) | | u = (x**2+5) |
| du = 2*x dx | | |
| 1/2 du = x dx | | x**2 = (u-5) |
|___________________| |_________________|
/ /
| x**3 sqrt(x**2+5) dx = | x**2 (x**2+5)**(1/2) x dx
/ /
/
= | (u-5) u**(1/2) (1/2)du
/
/
= (1/2) | (u-5) u**(1/2) du
/
/
= (1/2) | (u**(3/2) - (5)u**(1/2)) du
/
= (1/2)(2/5) (u**(5/2) - (1/2)(2/3) (5)u**(3/2)) + c
= (1/5) u**(5/2) - (5/3) u**(3/2) + c
/
| (x+6) * sqrt(x+5) dx = (1/5) (x**2+5)**(5/2) - (5/3) (x**2+5)**(3/2)) + c
/