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.
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?
radius of a spherical planet
Getting the indices from a vector
Duplicate each element of a vector.
Generate N equally spaced intervals between -L and L
factorial of a number x
Counting the Grand Primes
Euclidean inter-point distance matrix
Sums of cubes and squares of sums
Euclidean distance from a point to a polynomial
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office