Problem 61165. Breaking straight lines
- one branch stands for the parent polynomial p;
- and another branch stands for the perpendicular line, r, to p that passes by the point P (see figure below).
- R, the breaking point;
- r, the 1×2 array that represents the perpendicular line. If r violates the definition of a function, return r = ''.
Solution Stats
Problem Comments
-
4 Comments
Running into numerical precision issues again, some testcases are using isequal instead of isapprox :)
As claimed, I fixed by using isapprox to allow for numerical errors whenever they are to be expected. I apologize if I failed to achieve that. It is really very difficult for me to accept wrong numbers as correct answers (especially, integer numbers or rational numbers with finite decimal part), because this violates my rule: To be or not to be.
@Luisa if you feel ill at ease with using isapprox in such cases, keep in mind that many rational numbers with finite decimal part are not perfectly representable as IEEE 754 floats on a computer. 0.8 and 0.6 from test case 2 are such numbers, so R_correct isn't actually correct either there.
Thank you, @Christian Schröder.
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
5 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!