This problem has been polished and additional test cases were added.
I believe all of the test solutions of this problem are wrong
I believe that this problem is fixed now.
I think there might still be some issues with the test suite, Grant. Currently, only test suites 1 and 3 have sum(arcsind(y_correct))=180 within a degree. For test suite 3, you need to take 180-arcsind(y_correct(3)) to get the sum to equal 180, but the sines of those two angles are still the same.
Please let me know if I am missing something - If you take the arcsin for the current answers for problem 2 (y_correct = [0.7174 0.7174 0.8608]), you get angles in degrees of [49.84 49.84 59.41], which does not add up to 180 degrees. If you take 180-59.41 to keep the sine of angle #3 consistent, you end up with a sum greater than 180 degrees. Since this example is two 3-4-5 right triangles joined together at the 4-side (since height=4 and Area=12), I think the answer for case 2 should be [0.8 0.8 0.96].
Yes, the test solutions are incorrect. If the height of the triangle is h, and if the sides are s, then the sine of the angle at the base is h/s. The test solutions have all calculated this as sin(h/s).
@William, Great catch! Thanks a lot. :)
Don't waste your time on this one, the tests are all wrong. All posted solutions use if/else or won't work (they might have worked once, before the tests were changed). I've tried using the sine definition, the opposite height, law of sines, etc (all of them agree at a solution that's different from the test cases). And if the tests aren't wrong, then the problem description needs to be fixed...
I apologize for not seeing this sooner. The problem has been fixed, again. Let me know if something is still wrong.
Shortest REAL solution so far. All the shorter ones use som form of cheating!
Project Euler: Problem 10, Sum of Primes
Scoring for oriented dominoes
Find nth maximum
Beginner's Problem - Squaring
multiply an array by its position number
Convert array of decimal numbers into binary numbers array.
Solve expression III
Set x value to each even index of vector y.
Solve expression I
Find the treasures in MATLAB Central and discover how the community can help you!
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