You will find the least value of for in two ways: by a search on a grid, and by the AM-GM formula. The checker compares the two for several values of .
The idea. Splitting into two halves gives , with equality at .
Your tasks.
grid_min(f, lo, hi, steps). Try steps + 1 equally spaced values of from lo to hi, and return the smallest value of f(x).amgm_bound(k). Return 3 * (k * k / 4) ** (1 / 3).best_x(k), the point of equality, (k / 2) ** (1 / 3).Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…