Let p be an even-degree polynomial with positive leading coefficient. Consider its vertical translation by shifting its graph by its average value over a specified interval [a, b], with a<b.
The interval [a, b] is defined such that the endpoints a and b stand for the least and the greatest x-values of the equation p(x) = y_peak, the lowest and the largest real solutions, respectively. Here, y_peak stands for the highest local maximum of the polynomial p (see non-scale figures below).
Given p, return
  • the endpoints a and b if they exist. Otherwise, return a = '' and b = '' (see Hint 1);
  • the shifting constant, k, which stands for the above vertical translation (see Hint 2). Return k = '' if the interval is empty.
Hint 1. An n-degree polynomial has exactly n roots (counting multiplicity) in the complex number system. An odd-degree polynomial always has at least one real root. Therefore, a real polynomial of even degree always has at least one vertex, but might not have local maxima.
Hint 2. To calculate the mean of a continuous function, use the integral definition.
input: p
output: [a, b, k]
Vertical shift

Solution Stats

3 Solutions

2 Solvers

Last Solution submitted on Jan 16, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...