Clear Filters
Clear Filters

The estimation error is strangely obtained from Simpson's 1/3 rule

42 views (last 30 days)
Hello, I am looking for the estimation error of Simpson's rule of thirds. When dx is 1.01, the integral value is 2908800 and the error is 0.01, but the estimation error is 5.5567e-09. Where did it go wrong?
clc; clear all; close all;
a = -1.93317553181561E-24;
b = 3.788630291530091e-21;
c = -2.3447910280083294e-18
d = -0.019531249999999518;
e = 18.74999999999999
fun = @(t) a.*t.^5 + b.*t.^4 + c.*t.^3 + d.*t.^2+e.*t
x = 0:0.1:960;
fx =fun(x);
for i =1:n
plot(x, fx,'k','linewidth',2);
fx_mid = fun(mid);
fx_left = fun(i-1);
fx_right = fun(i);
area_temp = dx/6*(fx_left +4*fx_mid+fx_right);
int = int + area_temp;
x_segment = linspace(i-1, i,100);
Px = fx_left * ((x_segment-mid).*(x_segment-i))/((i-1-mid)*(i-1-i))...
+ fx_mid*((x_segment-i+1)).*(x_segment-i)/((mid-i+1)*(mid-i))...
+ fx_right * ((x_segment-i+1).*(x_segment-mid))/((i-i+1)*(i-mid));
area(x_segment,Px); hold on;
E_a = -((960.^5)/(2880.*1.01.^4)).*(a.*120.*C+24.*b);%Is there a problem here?
int_true = 2880000
  1 Comment
Steven Lord
Steven Lord on 23 May 2024 at 13:51
The user posted about this at least three times. While I closed one of them as duplicate, both this post and have useful comments or answers.

Sign in to comment.

Accepted Answer

Ayush Anand
Ayush Anand on 22 May 2024 at 8:11
Edited: Ayush Anand on 22 May 2024 at 8:18
There is a mistake with your formulae for estimation of . The formula for the error estimate in Simpson's rule is generally given by:
where ξ is some number in the interval [a, b], n is the number of intervals, and is the fourth derivative of the function being integrated.
Given your function: ; the fourth derivative of would be:
So, given the interval and with , the formulae for looks like:
Replacing formulae for in your code with this should give you the correct results.
You can check this out for reading more on Simpson's rule:
Ayush Anand
Ayush Anand on 23 May 2024 at 4:49
If the fourth derivative coefficient is very small, the error estimate will indeed be very small. The estimation error provided by Simpson's rule is not always an exact reflection of the true error; it's an estimate that depends on several factors, including the behavior of the function being integrated and the specifics of the numerical method being used. It assumes that the derivative in consideration is relatively constant or at least does not exhibit extreme variations within the interval. For well-behaved functions, where these assumptions hold true, the error estimate can be quite accurate or at least provide a good approximation of the actual error. For functions with significant variations in higher-order derivatives or with singularities, the estimate might not be as reliable.
재훈 on 24 May 2024 at 1:49
Thank you so much for your help. Thanks to this, I learned a little more about estimation error. have a good day! cheers

Sign in to comment.

More Answers (0)


Find more on Numerical Integration and Differential Equations in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!