Professional Documents
Culture Documents
6
6
6
a = - 1;
b = 2;
h = b - a;
c = h / 2 (f[a] + f[b]);
int = Integrate[x + Exp[- x ^ 2], {x, - 1, 2}]
Print["The area approximatedvalue by Trapezoidal rule is ", N[c]]
Print["Original valueof the integral is ",
N[int], "and the error is ", Abs[N[c] - N[int]]]
1
Out[6]= 3 + π (Erf[1] + Erf[2])
2