Let p be a quadratic polynomial, with its axis of symmetry being the y-axis. Considering the vertical shift of its vertex to the origin, find the positive constant, k, that scales the shifted parabola such that its area over the interval [-a; a] (a>0) will be equal to the area under the original parabola (see figure below).
input: (p, a)
output: k
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers6
Suggested Problems
More from this Author18
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Would you mind adding a tolerance check for the test cases? My solution is failing two test cases due to numerical precision.
Thank you @Matthew Bolyard. I fixed the non-integer answers with a tolerance.
Anyway, congratulations on finding the most concise solution!