Problem 61157. Scaling vertically parabola by evaluating its area over an interval
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
Matthew Bolyard
on 15 Jan 2026 at 18:01
Would you mind adding a tolerance check for the test cases? My solution is failing two test cases due to numerical precision.
Luisa
on 16 Jan 2026 at 15:07
Thank you @Matthew Bolyard. I fixed the non-integer answers with a tolerance.
Anyway, congratulations on finding the most concise solution!
Solution Comments
Show commentsProblem Recent Solvers4
Suggested Problems
More from this Author15
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!