There have been multiple reports of a “bug” in the triangle exercise. The instructions read, "We opted to not include tests for degenerate triangles (triangles that violate these rules) to keep things simpler. " Some students are reading this as ""We opted to not include tests for [degenerate triangles] triangles that violate these rules. " then pointing out that the tests do include invalid triangles.
I propose the following change.
-We opted to not include tests for degenerate triangles (triangles that violate these rules) to keep things simpler.
+_Degenerate triangles_ are triangles where the sum of the length of two sides is **equal** to the length of the third side, e.g. `1, 1, 2`.
+We opted to not include tests for degenerate triangles in this exercise.
So this was not an explanation of what is “degenerate triangle”. Still I can not figure out what it was supposed to mean.
Not doing tests for degenerate triangles makes sense now that I know the definition. Floating point numbers are not designed to be tested for equality.
The term “these rules” are referring to the phrase, “the sum of the lengths of any two sides must be […] equal to the length of the third side.” The note fails to define “degenerate triangle” and instead simply makes a comment about degenerate triangles.
Per the example, 1, 1, 2, this has nothing to do with floating point numbers. How floating point numbers are handled is a track level issue and not handled in the problem specs. Note, floating point numbers can be compared quite well in some situations ;)
I haven’t gone and dug up the multiple and lengthy discussions we’ve had around this exercise and the definition of Triangles. But there are quite a few. Feels like our continued fiddling with it is making things worse and not better - so I am pretty reticent to go into another cycle.
I understand the impulse to make things less confusing for everyone, but I am not optimistic that we can actually do so.
There’s been a bunch of discussion about “is a degenerate triangle a triangle or not” so this note was added recently saying, “we explicitly are excluding degenerate triangles from the test, move along”. This proposal aims to clarify that note and make it explicit that we are “excluding a degenerate triangle from the tests”, and not “excluding all invalid triangles from the tests”.
A triangle is defined to be a polygon with three courners (hence with three sides). This must be the starting point.
Each triangle satifies the triangle inequality, which states that when the lengths of the three sides of a triangle is a, b, and c, repsecitvely,
it holds that
a + b > c.
The triangle inequality is a necessary condition for a shape to be a triangle.
The triangle inequality is not a sufficient condition for a shape to be a triangle (e.g, three distinct line segments of length 1 parallel to each other do not form a triangle).
We must not mix tne triangle inequality (for triangles) with the triangle inequlity in metric spaces, which states that given three points x, y, and z in a metric space with distance dist
dist(x, y) + dist(y, z) >= dist(x, z).
(This inequality actually defines the nortion of distances.)
What people call degenerate triangles in this forum cannot be a triangle, because they violate the tirangle inequality. In absence of the triangle inequality, you actually cannot find courners, can you? Without courners, how do you define sides (and their lengths).
So, let me repeat my point. A triangle is defined to be a polygon with three courners (hence with three sides). This must be the starting point.
Here are what I would do.
Remove the entire “Note” section from the description.
Remove “See Triangle Inequality” near the end of the page. The link leads to the page that essentially talks about the definition of the triangle inequality in metric spaces.
Some problems should be removed along the same line.
I have already tried to sell this idea here before. So, I would not be surprised to see the same conclusion again.
This is one definition. It’s not the accepted definition.
A triangle is a polygon with three vertices.
A vertex can have an angle of 179, 181 or 180 degrees. Those are all valid vertices.
A degenerate triangle is a triangle. It has three vertices. But this whole semantics argument is something we are explicitly excluding the from exercise. We don’t want to go back and forth any more over whether or not a degenerate triangle is a triangle or not so we are explicitly excluding that from the exercise. It’s explicitly not being addressed in this exercise.
See the original post. This exercise already has a note saying that we are excluding degenerate triangles. I am suggesting that we make that note more clear. Students are currently confused about what the note is saying, and I think it makes sense to clarify that note. I am not suggesting that we change the intended messaging.
I know that you cannot make any big changes at this point, and I am not that interested in this exercise. But you responded politely, let me show my thoughs, which you can safely ignore. Essentially the exercise is telling students to answer two incompatible questions:
A triagle is given. What type of triangle is it, equilateral, isosceles, or scalene?
Is the shape a triangle?
To answer the first question, it is essential for a studnet knows that the given shape is a triangle. Without this provision, the lengths of the three sides are useless.
But students are also supposed to answer the second question. If the second question is meaningful, the shape can be something other than a triangle. The provision in the first question is gone. In addition, the second question is something impossible to answer. Even when the three sides satisfy the triangle inequality, the three sides may be disconnected, or they may cross each other. No one can solve this problem.
In summary, it is the second question that has ruined the exercise.
Big changes are always possible. But that’s explicitly not the purpose of this post I’d prefer to try to keep this on the original topic so we can discuss whether or not the proposed change makes sense and improves the exercise.
This is a programming exercise not a geometry one. We should not load it with unrelated geometry lingo.
No, three numbers are given. We need to process the information somehow and we do not really care if it is a triangle or a quadrapod or a bicycle. The story gives a hint that the problem has some real application but we do not need to dive deep into the real world problems. Just tell a fictional story to make the exercise entertaining.
The term “degenerate triangle” already exists in this exercise. Exercises often introduce “lingo” for exercises, which is entirely file so long as the term is relevant and well defined. Introducing the term “degenerate triangle” is not related to the proposed change
Please stick to the original topic. I explained an issue with the exercise as it exists and proposed a change to eliminate the issue and improve the exercise. Do you have thoughts on the issue mentioned or the proposed improvement?
No, it is only mentioned in the note. I learned geometry in a language different from English so I did not recognize the word at first. This made me mix up “degenerate” and “invalid”.
I like that you propose the definition for “degenerate”. It makes it clear that it is different from “invalid”.