# How to verify the integral remainder of this integral formula?

The following questions are from the 2018 professional course test of numerical analysis of 武汉岩石所: For the integral formula $$\int_{0}^{h} f(x) d x \approx \frac{h}{2}[f(0)+f(h)]+\alpha h^{2}\left[f^{\prime}(0)-f^{\prime}(h)\right]$$:

1. We need to determine the value of $$\alpha$$ to make it have the highest algebraic accuracy. 2. Suppose that the integrand f(x) has the fourth order continuous derivative, it needs to be verified that when $$\alpha=\frac{1}{12}$$, the integral remainder of this formula is $$R(f)=\frac{1}{720} h^{5} f^{(4)}(\eta), \quad \eta \in[0, h]$$.

Outer[Construct, {h/2 &, h/2 #1 &, h/2 #1^2 &, h/2 #1^3 &}, {0,
h}].{1, 1} +
Outer[Construct, {0 &, α*h^2 &, α*
h^2 2 #1 &, α*h^2 3 #1^2 &}, {0, h}].{1, -1} ==
Integrate[{1, x, x^2, x^3}, {x, 0, h}]


From the results of the above code, I can know that when $$\alpha=\frac{1}{12}$$, the integral formula $$\int_{0}^{h} f(x) d x \approx \frac{h}{2}[f(0)+f(h)]+\alpha h^{2}\left[f^{\prime}(0)-f^{\prime}(h)\right]$$ has the highest algebraic accuracy. But for the second question, I don't know how to verify it with MMA. I want to get as many methods as possible to verify the second problem.

Supplementary questions:

The following questions are from the 2015 professional course test of numerical analysis of 武汉岩石所: The main idea of this problem is to determine the coefficients A0, A1, A2, so that the integral formula $$\int_{0}^{2 h} f(x) d x \approx A_{0} f(0)+A_{1} f(2 h)+A_{2} f^{\prime}(2 h)$$ has the highest algebraic accuracy and gives the expression of the integral remainder.

Solve[((Outer[
Construct, {# &, #[2 h] &, #'[2 h] &}, {1 &, # &, #^2 &}] //
Transpose).{A0, A1, A2}) ==
Integrate[{1, x, x^2}, {x, 0, 2 h}], {A0, A1, A2}]


After comparison with the reference answer, we can know that the result of the above code is correct.

But when I use the Ulrich Neumann's method to solve this problem, I can't get the desired result:

Collect[Series[
Integrate[
f[x], {x, 0, 2 h}] - (A0*f + A1*f[2 h] + A2*f'[2 h]), {h, 0,
5}], {h, h^_}]


I want to know how to use series expansion method to solve this problem.

The following questions are from the 2016 professional course test of numerical analysis of 武汉岩石所: I can't even know how to use series to expand $$\int_{0}^{\infty} e^{-x} f(x) d x - A_{1} f\left(x_{1}\right)-A_{2} f\left(x_{2}\right)$$. What should I do?

The following truncation error expression of Simpson's integral formula comes from this book: Integrate[
Derivative[f][η]/
4! (x - a) (x - (2 a + b)/3) (x - (a + 2 b)/3) (x - b), {x, a, b}]

• I would expect \[Alpha]==-1/12 ! Oct 14, 2020 at 10:29
• @UlrichNeumann Thank you for your comments. Maybe I copied the question incorrectly. I hope you can provide the detailed code for my reference. Oct 14, 2020 at 10:33

Series[Integrate[f[x], {x, 0,h}] - (h/2 (f + f[h]) + \[Alpha] h^2 (f' - f'[h])), {h, 0,3}]
(* f''(\[Alpha]-1/12)h^3+O[h^4]*)


Optimal \[Alpha]==1/12

Series[Integrate[f[x], {x, 0, h}] - (h/2 (f + f[h]) +1/12 h^2 (f' - f'[h])), {h, 0, 5}]

• Another difference is that the answer is $f^{(4)}(\eta)$ and yours is $f^{(4)}(0)$. Oct 15, 2020 at 2:17