Area Under Curves and Volume of Revolving a Curve Discussions | Functional Programming | HackerRank
We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
For the first given sample, the only way to get the "correct" value of 2435300.3 is if you sum up all of the slices between 1.0 and 4.0, inclusive.
However, that would be incorrect. It should be all of the slices between 1.0 and 3.999, inclusive, which sums to 2428775.4. By including the last slice STARTING at 4.0, you're actually including the slice representing 4.0 to 4.001, which is clearly outside the target bounds.
I'm somewhat disappointed with this "Introduction" to "Functional Programming" example, since its mostly just an exercise in calculus (but there is already a Mathematics domain here for that). This should have given us the motivation and the formulas, and then we pratice implementing them in our given language.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Area Under Curves and Volume of Revolving a Curve
You are viewing a single comment's thread. Return to all comments →
I'm pretty sure the sample data is wrong.
For the first given sample, the only way to get the "correct" value of
2435300.3
is if you sum up all of the slices between 1.0 and 4.0, inclusive.However, that would be incorrect. It should be all of the slices between 1.0 and 3.999, inclusive, which sums to
2428775.4
. By including the last slice STARTING at 4.0, you're actually including the slice representing 4.0 to 4.001, which is clearly outside the target bounds.I'm somewhat disappointed with this "Introduction" to "Functional Programming" example, since its mostly just an exercise in calculus (but there is already a Mathematics domain here for that). This should have given us the motivation and the formulas, and then we pratice implementing them in our given language.