Problem 44631. Make your own Test Suite (part 0)
Hint: when the Problem Statement uses phrases like "reasonably accurate" and "sufficiently accurate", it is a clue that your Test Suite should not require 'equality' to any 'exact values', but rather should include a small tolerance to allow for unavoidable floating-point imprecision.
It was very hard to understand what do you mean.
I'm glad you managed to find a solution. I tried to provide a few extra clues, such as in the Solution Template and in the comment from 02 June. Players will benefit from looking up the Documentation on functions such as "assert", "isequal", etc., along with information on "Floating-Point Numbers" at https://au.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html . There are also many other resources online, such as www.floating-point-gui.de . For some people this should be a simple problem to implement their existing knowledge; for other people, it should be a learning process. —DIV
Since assert is not working anymore, it is necessary to use the dummy variable and the function error.
Rafael, I had not been not aware that the assert() function has been disallowed on Cody. Thank-you for alerting us to that.
Previously it was working, and actually it is the function that ideally 'should' be used, so I am not going to alter the problem statement.
However I agree that with the current Cody prohibition on players using assert() in their solutions, the error() function will have to be used instead.
However, I can confirm that it is *not* necessary to use any dummy variables at all.
P.S. I believe assert() was disallowed because of a small number of Cody players who brazenly cheated their way through numerous problems. Ideally there should be a switch in Cody to allow the assert() function to be used for specific individual problems, in which case there are some special measures that can be implemented to prevent such exploits. For example, running the command "! rm -v assert.m" (without quotation marks) in the Test Suite.
David, I agree 100% that certain functions should be allowed in individual problems, if selected by the problem author.
Solution CommentsShow comments
Problem Recent Solvers5
Remove the polynomials that have positive real elements of their roots.
Find perfect placement of non-rotating dominoes (easier)
07 - Common functions and indexing 6
More from this Author32
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!