Problem 381. Angle between two vectors
You have two vectors , determine the angle between these two vectors
For example:
u = [0 0 1]; v = [1 0 0];
The angle in degrees between u and v is 90.
Solution Stats
Problem Comments
-
6 Comments
It would be good to have a more challenging test suite - see the guidelines for problems. Some solvers write code that is just a lookup table for the test cases, and having only one case makes it trivial to do this.
Also, your test should not use string comparison to evaluate what is a purely numerical computation. It would be better if you subtracted the correct answer from the proposed answer, and then compared the absolute value to a am all threshold, such as 1e-6.
Thnaks for your comments. It was my first or second problem sent to CODY. I didn't catch all the tricks to make strong test cases yet.
I have rescored the problem after adding more robust test suites.
only one test case runs, others are not working
I don't understand why the checker is rounding the answers, nor why some implementers are rounding the answers. Maybe it's to avoid roundoff issues, which admittedly are an issue when testing equivalence, but any reasonable solution to the problem should be able to give an answer out to 5 or 6 decimal places.
Solution Comments
Show commentsProblem Recent Solvers618
Suggested Problems
-
3663 Solvers
-
4461 Solvers
-
336 Solvers
-
384 Solvers
-
find the surface area of a cube
526 Solvers
More from this Author30
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!