Test suite needs to be improved.
This is the first problem I create.
Thanks for your answer and your kind comments.
Adrian, welcome to Cody. That looks like an interesting problem. Unfortunately, there are only two test cases, and they contain the same answer. Hence, many of the answers supplied so far seem to game the system by just returning that one value. Please consider including more test cases with different answers to discourage hard-coded solutions that don't actually solve the problem. Note that even though the problem has been posted, you can still edit it.
I agree with goc3 (and M. Eicholtz).
One further point of detail is that you didn't actually need to set the existing two 'correct' answers to be identical. In reality the correct answers are 0.29990196 (approx.) and 0.2919 (exactly). While it is indeed admirable that you have employed a tolerance in your assertion command, with this type of problem there should be no difficulty for submissions to be accurate to at least 6 decimal places, so a tighter (stricter) tolerance is advisable here.
Compute a dot product of two vectors x and y
Duplicate each element of a vector.
Television Screen Dimensions
Area of a Square
Divisible by 3
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office