Problem 51102. Round the chord length!!
Hello Fatima Abdullah HCT 2021,
I interpreted circumference y as arclength and computed the length of the chord subtending the angle. I get 0.841 for the first test. Please check the angle in your code. As it is written, it is not dimensionless.
Just use the chord length formula using trigonometry and then the rounding command. That's it!
I added extra test suite. You can check them.
I have to agree with ChrisR. None of the answers are correct. The first two answers are using the diameter as if it were the radius when calculating the angle. I don't know what the third one has done.
I will give you a hint! go ahead and google Chord Length Using Trigonometry. You will easily answer the question!
Fatima, your solution takes the angle (i.e., half of the angle of the chord) as y/2. If the arclength is y and the radius is x/2, then the full angle is y/(x/2), and half of the angle is y/x.
By "circumference", do you mean the angle measured in radians?
Yes in radians.
@Fatima, mention it in the problem statement as it is quite ambiguous
HI Fatima, I think the correct term is "central angle" instead of circumference.
As I've said in one of your previous problems, Fatima. Human language is imprecise. It would help if you replaced the noun circumference with the noun central angle. It was probably a translation problem; however, if you had drawn a sketch, no one would have had any doubts about what you meant. Or use an example if you don't like to sketch.
Solution CommentsShow comments
Problem Recent Solvers19
Back to basics 21 - Matrix replicating
Find x rows where the sum of the numbers is the maximum
More from this Author4
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!