Problem 1428. Find the optimal shape to bring the maximum product by a given perimeter

Solution 1194376

Submitted on 21 May 2017 by Andrew Newell
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
p = 10; [Nopt,prod] = max_product(p); assert(isequal(Nopt,4)) assert(abs(prod - 39.0625)<1e-4)

2   Pass
p = 29; [Nopt,prod] = max_product(p); assert(isequal(Nopt,11)) assert(abs(prod - 4.276204243443044e+04)<1e-4)

3   Pass
p = 49; [Nopt,prod] = max_product(p); assert(isequal(Nopt,18)) assert(abs(prod - 6.739448339947788e+07)<1e-4)

4   Pass
p = 256; [Nopt,prod] = max_product(p); assert(isequal(Nopt,94)) assert(abs(prod - 7.953137683223010e+40)<1e-4)

5   Pass
p = 1000000; [Nopt,prod] = max_product(p); assert(isequal(Nopt,367879)) assert(isinf(prod))

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!