Problem 43003. Simpsons's rule (but not Homer Simpson)
If this problem gains some interest, I'll start trying to post additional problems. My idea is to build a new problem set, for general numerical methods like this.
Great problem along with a very clear description. Looking forward to your addtional problems in numerical analysis.
I've asked Ned how to create a new problem group first. (I don't think if I have that privilege.) Then I plan to establish a few new problem groups for problems like this. Perhaps a numerical methods group, a computational geometry group, others? I hope there will also be some existing problems I can then include in addition to those I will write.
Great idea to create a new problem group! Numerical analysis is definitely good problem group to start with. There are already some numerical integration problems which I have solved on Cody (such as a general integration problem: https://www.mathworks.com/matlabcentral/cody/problems/1031-composite-trapezoidal-rule-for-numeric-integration, and a problem dealing with trapezoidal rule: https://www.mathworks.com/matlabcentral/cody/problems/1031-composite-trapezoidal-rule-for-numeric-integration). I guess these problems can be included in a numerical analysis group.
Sorry for the wrong link. A general numerical integration problem: https://www.mathworks.com/matlabcentral/cody/problems/1197-numerical-integration, and a trapezoidal rule problem: https://www.mathworks.com/matlabcentral/cody/problems/1031-composite-trapezoidal-rule-for-numeric-integration. I realize that Cody does not allow users to modify/delete their own comments, which is very inconvenient.
Thanks for the problem links. I'll forward that idea about editing comments to the site developers.
Nice problem, but #7 in the Test Suite needs an assert in it.
There's something I don't understand. The first function I wrote, according to Simpson's rule, passed all tests except #6; here the absolute error was still very small (~1.53e-15) but greater than the tolerance, so my first solution failed the test set. Thus I had to add a small correction factor of 1e-15. Now the function passes all tests, but I can't understand the error in my implementation.
@Giovanni I had the same problem; the test case is overzealous.
I used the same formula and failed test 6. I think it's because of the machine error eps. Is that why you had 1e-15 at the end?
Problem Recent Solvers30
convert matrix to single column
Find the dimensions of a matrix
Convert given decimal number to binary number.
More from this Author4
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!