Let p be an even-degree polynomial with positive leading coefficient. Consider the scale factor, k, that vertically transforms the polynomial p by scaling (1) the entire function and (2) only the leading coefficient (see figure below). To compare both cases, (1) and (2), find
- V0, the m0×2 matrix that represents the vertex of the original polynomial p;
- V1, the m1×2 matrix that represents the scaled vertex for case 1:
- V2, the m2×2 matrix that represents the scaled vertex for case 2;
where 1 <= m0, m1, m2 < n and n stands for the degree of polynomial (see Hint). Return the first column of each matrix sorted by increasing x-values (in ascending order), while the y-value of the vertex in the second column.
Hint. The vertex of an even-degree polynomial is not necessarily unique, i.e., the global extremum may be reached at m, multiple distinct, x-values.
input: (p, k)
output: [V0, V1, V2]
Solution Stats
Problem Comments
5 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers6
Suggested Problems
-
Comparing to scale all terms versus one term of even-degree polynomial by the same scale factor
6 Solvers
More from this Author19
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
It's good that you're using isapprox in many cases, but still, could you make the tolerance required by the test suite just a LITTLE less exacting?
@Christian Schröder sorry for my late answer.
I already asked, without any sucess until the moment,
for "Alerting new comments in 'My Groups' page"
https://www.mathworks.com/matlabcentral/discussions/cody/886065?s_tid=prof_contrib_discussion
and "Alerting new comments in 'My Problems' page"
https://www.mathworks.com/matlabcentral/discussions/cody/885520?s_tid=prof_contrib_discussion
Sorry I do not understand where you found the need for less accuracy, because I had already established different tolerances for the problematic answers. Anyway, all answers are given for your convenience, and furthermore it is difficult to detect all computational errors that may arise. I know you already said that MATLAB uses the ANSI/IEEE Standard 754. However, if there are so many discrepancies in these problems, I can not imagine what happens in real-world problems.
@Luisa I agree such a feature would be very nice to have.
See solution 14998448 for a solution attempt that failed due to rounding.
Thank you @Christian Schröder. I fixed it.
Thank you, Luisa! Much appreciated!