Nominal Animal:
? Would you be able to to take a couple seconds, to explain something you outlined ?
It's; (X1 - X min.) and that was multiplied by two; W1 = 2 (X1 - X min.)
I didn't follow that, as to where the '2' came from, in the Rieman method. Plus, actually, not making progress putting that (above formula) in a plain English and graphical context.
Help appreciated !
Rick
Good catch! It should be *divided* by two, not multiplied by two.
Let's consider the case where we have five \$x\$ coordinates, \$x_\min\$, \$x_1 = -1\$, \$x_2 = 0\$, \$x_3 = 1\$, and \$x_\max = 2\$,
in the middle of each interval, each rectangle –– except for the first and last one –– so we have five intervals in total.
The first interval is from \$x_\min\$ to midway between \$x_\min\$ and \$x_1\$: \$x_\min\$ to \$(x_1 + x_\min) / 2\$.
The second one is from midway between \$x_\min\$ and \$x_1\$ to midway between \$x_1\$ and \$x_2\$: \$(x_1 + x_\min)/2\$ to \$(x_2 + x_1)/2\$.
The third one is from midway between \$x_1\$ and \$x_2\$ to midway between \$x_2\$ and \$x_3\$: \$(x_2 + x_1)/2\$ to \$(x_3 + x_2)/2\$.
The fourth one is from midway between \$x_2\$ and \$x_3\$ to midway between \$x_3\$ and \$x_\max\$: \$(x_3 + x_2)/2\$ to \$(x_\max + x_3)/2\$.
The last one is from midway between \$x_3\$ and \$x_\max\$ to $x_\max\$: $(x_3 + x_\max)/2\$ to \$x_\max\$.
Their widths are thus
$$\begin{aligned}
w_1 &= \frac{x_1 + x_\min}{2} - x_\min &= \frac{x_1 - x_\min}{2} \\
w_2 &= \frac{x_2 + x_1}{2} - \frac{x_1 + x_\min}{2} &= \frac{x_2 - x_\min}{2} \\
w_3 &= \frac{x_3 + x_2}{2} - \frac{x_2 + x_1}{2} &= \frac{x_3 - x_1}{2} \\
w_4 &= \frac{x_\max + x_3}{2} - \frac{x_3 + x_2}{2} &= \frac{x_\max - x_2}{2} \\
w_5 &= x_\max - \frac{x_\max - x_3}{2} &= \frac{x_\max - x_3}{2} \\
\end{aligned}$$
The height of the first rectangle is \$f(x_\min)\$, the second rectangle \$f(x_1)\$, the third rectangle \$f(x_2)\$, the fourth rectangle \$f(x_3)\$, and the fifth rectangle \$f(x_\max)\$.
Thus, the areas of each rectangle, i.e. the approximate integral over each interval, are
$$\begin{aligned}
A_1 &= f(x_\min) \frac{x_1 - x_\min}{2} \\
A_2 &= f(x_1) \frac{x_2 - x_\min}{2} \\
A_3 &= f(x_2) \frac{x_3 - x_1}{2} \\
A_4 &= f(x_3) \frac{x_\max - x_2}{2} \\
A_5 &= f(x_\max) \frac{x_\max - x_3}{2} \\
\end{aligned}$$
and the approximate integral is their sum, \$A_1 + A_2 + A_3 + A_4 + A_5\$.
Yes, the first and last rectangles are narrower than the others. (I also should have shown how \$w_2\$ and \$w_{N-1}\$ are calculated, but forgot, because I usually use \$x_0 = x_\min\$ and \$x_{N-1} = x_\max\$.)