comp.lang.ada
 help / color / mirror / Atom feed
* Ada Tutor: Outside Assignment 2 - Question to the Solution
@ 2012-12-19 23:18 Cedric
  2012-12-19 23:43 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Cedric @ 2012-12-19 23:18 UTC (permalink / raw)


Hi All,

I try to learn Ada using Ada Tutor (http://zhu-qy.blogspot.de/2012/08/adatutor.html). I tried the excerise of the outside assignment 2 and do not understand the given solution.

The test driver says that the tests

  Compare( 2,  4,  6, Not_A_Triangle);
  Compare( 1,  3,  2, Not_A_Triangle);
  Compare( 3,  1,  2, Not_A_Triangle);
  Compare( 1,  2,  4, Not_A_Triangle);
  Compare( 1,  4,  2, Not_A_Triangle);
  Compare( 4,  1,  2, Not_A_Triangle);

  Compare( 3,  3,  7, Not_A_Triangle);
  Compare( 3,  7,  3, Not_A_Triangle);
  Compare( 6,  3,  3, Not_A_Triangle);

do not define a valid triangle. The solution says

      if Len1 + Len2 <= Len3  or Len1 + Len3 <= Len2
         or Len2 + Len3 <= Len1  then
         Answer := Not_A_Triangle;

and 

You must have realized by now that it's impossible to draw a triangle with sides 1, 2, and 3.  The sum of any two sides must be greater than the third.

What is the exact mathematic definition of a triangle? My last math course a quick a while ago :(

I would assume that a triangle formed by 1, 2 and 3 would give a valid triangle. Why should that not be the case?

Regards

Cedric



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Tutor: Outside Assignment 2 - Question to the Solution
  2012-12-19 23:18 Ada Tutor: Outside Assignment 2 - Question to the Solution Cedric
@ 2012-12-19 23:43 ` Georg Bauhaus
  2012-12-20  0:15 ` Adam Beneschan
  2012-12-20 11:16 ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: Georg Bauhaus @ 2012-12-19 23:43 UTC (permalink / raw)


On 20.12.12 00:18, Cedric wrote:
> You must have realized by now that it's impossible to draw a triangle with sides 1, 2, and 3.  The sum of any two sides must be greater than the third.
>
> What is the exact mathematic definition of a triangle? My last math course a quick a while ago:(
>
> I would assume that a triangle formed by 1, 2 and 3 would give a valid triangle. Why should that not be the case?

(It has helped me, and, in fact, a few kids I know if you don't mind,
to represent these abstract lengths (if that's what they are) as steps
a man can walk. If one person walks for 1 step, then 2 ... how far
would this person have got in steps? What about some other person
taking three steps on a straight line?
If you flattened the two shorter paths by "bending" them towards
the 3-step path, what happens?)






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Tutor: Outside Assignment 2 - Question to the Solution
  2012-12-19 23:18 Ada Tutor: Outside Assignment 2 - Question to the Solution Cedric
  2012-12-19 23:43 ` Georg Bauhaus
@ 2012-12-20  0:15 ` Adam Beneschan
  2012-12-20  9:13   ` Manuel Collado
  2012-12-20 11:16 ` Stephen Leake
  2 siblings, 1 reply; 6+ messages in thread
From: Adam Beneschan @ 2012-12-20  0:15 UTC (permalink / raw)


On Wednesday, December 19, 2012 3:18:00 PM UTC-8, Cedric wrote:
 
> I would assume that a triangle formed by 1, 2 and 3 would give a valid triangle. Why should that not be the case?

I'd recommend trying it yourself ... cut three pieces of string whose lengths are 1, 2, and 3 inches (or 1, 2, and 3 cm if you prefer; or if that's too small, try 3, 6, and 9 cm).  Then try to make a triangle.  I think you'll see what the problem is.

                         -- Adam





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Tutor: Outside Assignment 2 - Question to the Solution
  2012-12-20  0:15 ` Adam Beneschan
@ 2012-12-20  9:13   ` Manuel Collado
  2012-12-20  9:27     ` Georg Bauhaus
  0 siblings, 1 reply; 6+ messages in thread
From: Manuel Collado @ 2012-12-20  9:13 UTC (permalink / raw)


El 20/12/2012 1:15, Adam Beneschan escribi�:
> On Wednesday, December 19, 2012 3:18:00 PM UTC-8, Cedric wrote:
>
>> I would assume that a triangle formed by 1, 2 and 3 would give a
>> valid triangle. Why should that not be the case?
>
> I'd recommend trying it yourself ... cut three pieces of string whose
> lengths are 1, 2, and 3 inches (or 1, 2, and 3 cm if you prefer; or
> if that's too small, try 3, 6, and 9 cm).  Then try to make a
> triangle.

They make a perfectly valid (degenerated) triangle:
   A B   C
   *-*---*

With sides 1,2 and 3, and angles 0�, 180� and 0�.


> I think you'll see what the problem is.

Of course. The problem is to agree if a degenerated triangle is or not 
an acceptable triangle.

-- 
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Tutor: Outside Assignment 2 - Question to the Solution
  2012-12-20  9:13   ` Manuel Collado
@ 2012-12-20  9:27     ` Georg Bauhaus
  0 siblings, 0 replies; 6+ messages in thread
From: Georg Bauhaus @ 2012-12-20  9:27 UTC (permalink / raw)


On 20.12.12 10:13, Manuel Collado wrote:
> The problem is to agree if a degenerated triangle is or not an acceptable triangle.

I think it the tutorial states what the sum of two sides
should be in relation to the third.

When will academia stop messing up teaching basics
of formal things, such as programming, by shifting
attention to other branches of mathematics, such
as geometry?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Tutor: Outside Assignment 2 - Question to the Solution
  2012-12-19 23:18 Ada Tutor: Outside Assignment 2 - Question to the Solution Cedric
  2012-12-19 23:43 ` Georg Bauhaus
  2012-12-20  0:15 ` Adam Beneschan
@ 2012-12-20 11:16 ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Leake @ 2012-12-20 11:16 UTC (permalink / raw)


Cedric <Cedric.Lannock@gmx.net> writes:

> What is the exact mathematic definition of a triangle? My last math
> course a quick a while ago :(

http://en.wikipedia.org/wiki/Triangle:

    In Euclidean geometry any three points, when non-collinear,
    determine a unique triangle and a unique plane (i.e. a
    two-dimensional Euclidean space).

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-20 11:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 23:18 Ada Tutor: Outside Assignment 2 - Question to the Solution Cedric
2012-12-19 23:43 ` Georg Bauhaus
2012-12-20  0:15 ` Adam Beneschan
2012-12-20  9:13   ` Manuel Collado
2012-12-20  9:27     ` Georg Bauhaus
2012-12-20 11:16 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox