Have no knowledge of "floating-point numbers"? Read the documentation, and/or try Problem 44690 first.
——————————————————————————————————————————
In this task you need to imagine that you — yes, YOU — have developed a problem on Cody for me to solve, and now you need to draft a naïve Test Suite as the first step in developing a more robust Test Suite that would check whether my submitted solutions meet your requirements or not.
So the tables are turned! You are now in the role of Tester! I am in the role of Player!
The problem you've set me is to:
You provide me with the following example for the function defined as s = SINE(a):
% INPUT a = 45 % degrees % OUTPUT s = 1/sqrt(2)
Now I have responded by submitting a large number of purported 'solutions', some of which are reasonably accurate, and others which are either too imprecise or else logically flawed.
Your final Test Suite (contained within your function testSuite) will have to address several aspects arising in your problem specification. However, for this 'first draft' you are creating a naïve Test Suite with only one requirement:
You can use the functions sind, sin, etc. in this draft Test Suite, if you want — even though this would be bad practice in your final Test Suite!
Thus, the above specification is merely a starting point. You will develop more robust Test Suites in:
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
Find the two most distant points
1236 Solvers
1312 Solvers
116 Solvers
Find a subset that divides the vector into equal halves
289 Solvers
22 Solvers