Mathmatica help, Riemann Sums
Let f(x)=100 (x-1)^3e^-x^2.
We want to approximate the value of the integral f(x) from .6 to 1.5
(a) Using Mathematica, create a table of the Simpson's Rule approximations for each of the following n: 3, 6, 12, 24, 48, 96, 192. You should be able to alter the code above to make these.
These codes were given:
Grid[Join[{{TextCell["Nints"], TextCell["Ln"]}}, Table[a = 1;
b = 2; dx = (b - a)/Nints;
x[i_] = a + i*dx; {Nints,
N[Sum[f[x[i]]*dx, {i, 0, Nints - 1}]]}, {Nints, {2, 4, 8, 16,
32, 64, 128,
256}}]], Frame -> All]
OR
a = .6;
b = 1.5;
n = 192;
Deltax = (b - a)/n;
xmid[i_] = a + ((i + (i - 1))/2) Deltax;
Table[xi[i], {i, 0, n - 1}]
Sum[f[xmid[i]]*Deltax, {i, 1, n}]
N[%]
But, I have no idea how to manipulate it so that it makes a table of Simpson's Rule values.
I started out with:
[B]Grid[Join[{{TextCell["Nints"], TextCell["Ln"]}}, Table[a = .6;
b = 1.5; dx = (b - a)/Nints;
x[i_] = a + i*dx; {Nints,
N[Sum[f[x[i]]*dx, {i, 0, Nints - 1}]]}, {Nints, {3, 6, 12, 24, 48, 96, 192}}]], Frame -> All]
How do I manipulate this code so that it will correspond to the riemann sum formulas? It's more of laying out the notation. It's hard to look at math this way.
Help very much appreciated. :)