Mathc initiation/001T
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
|---|
/* --------------------------------- */
/* save as c00b.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fb.h"
/* --------------------------------- */
int main(void)
{
double M = simpson(f,a, b, LOOP);
double N = simpson(g,a, b, LOOP);
double P = simpson(h,a, b, LOOP);
clrscrn();
printf("Second property of linearity, \n\n"
" (b (b (b \n"
"int(g(x)+h(x) dx = int(g(x) dx + int(h(x) dx \n"
" (a (a (a \n\n\n");
printf(" g : (x)-> %s \n", geq);
printf(" h : (x)-> %s \n\n", heq);
printf(" f : (x)-> %s \n\n", feq);
printf(" f(x) = g(x) + h(x) \n\n");
stop();
clrscrn();
printf(" f : (x)-> %s \n\n", feq);
printf(" (%.3f \n", b);
printf(" M = int( %s dx = %.6f \n", feq, M);
printf(" (%.3f \n\n\n", a);
printf(" g : (x)-> %s \n\n", geq);
printf(" (%.3f \n", b);
printf(" N = int( %s dx = %.6f \n", geq, N);
printf(" (%.3f \n\n\n", a);
printf(" h : (x)-> %s \n\n", heq);
printf(" (%.3f \n", b);
printf(" P = int( %s dx = %.6f \n", heq, P);
printf(" (%.3f \n\n\n", a);
stop();
clrscrn();
printf("Second property of linearity \n\n"
" (b \n"
" M = int( g(x) + h(x) dx = %.6f \n"
" (a \n\n"
" (b (b \n"
" N+P = int( g(x) dx + int( h(x) dx = %.6f \n"
" (a (a \n\n\n",
M, N+P);
stop();
return 0;
}
/* --------------------------------- */
/* --------------------------------- */
Verifier avec mathematica : Free: wolframalpha.com
integral (x**2 + cos(x)+1) dx from 0 to 1
Exemple de sortie écran :
Second property of linearity,
(b (b (b
int(g(x)+h(x) dx = int(g(x) dx + int(h(x) dx
(a (a (a
g : (x)-> (x**2)
h : (x)-> (cos(x)+1)
f : (x)-> (x**2)+(cos(x)+1)
f(x) = g(x) + h(x)
Press return to continue.
f : (x)-> (x**2)+(cos(x)+1)
(1.000
M = int( (x**2)+(cos(x)+1) dx = 2.174804
(0.000
g : (x)-> (x**2)
(1.000
N = int( (x**2) dx = 0.333333
(0.000
h : (x)-> (cos(x)+1)
(1.000
P = int( (cos(x)+1) dx = 1.841471
(0.000
Press return to continue.
Second property of linearity
(b
M = int( g(x) + h(x) dx = 2.174804
(a
(b (b
N+P = int( g(x) dx + int( h(x) dx = 2.174804
(a (a
Press return to continue.