From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Surprise in array concatenation
Date: Wed, 7 Sep 2005 23:23:56 +0200
Date: 2005-09-07T23:23:14+02:00 [thread overview]
Message-ID: <3sa7ilukre24.15c984skqvm9c$.dlg@40tude.net> (raw)
In-Reply-To: 431f2f4f$0$2102$9b4e6d93@newsread2.arcor-online.net
On Wed, 07 Sep 2005 20:20:56 +0200, Georg Bauhaus wrote:
> Dmitry A. Kazakov wrote:
>> On Tue, 06 Sep 2005 17:51:11 +0200, Georg Bauhaus wrote:
>
> Almost no real number can be represented in a computer.
OK, it is beaten to death. See Richard's paradox. Its free interpretation,
I quote J. E. Littlewood from memory, is: let there be integer numbers
which cannot be defined by sentences shorter than 12 words. "This set is
bounded and thus contains the lowest number N." This sentence defines N and
amazingly contains only 11 words.
>>>>Do you really believe
>>>>that 1 is *the* 1? Did you see a label "made in Heaven" on it? (:-))
>>>
>>>Type Positive starts at 1 and ends with Positive'Last.
>
>> ... and it does this not symbolically, but physically
>
> yes.
>
>> by attaching a tiny
>> rubber thread to the Platonic number 1. Right? (:-))
>
> no.
How else you could check if 1 really refers to the physical 1! Maybe some
scoundrel has reconnected all 1s in your computer to the physical 946.23,
while you slept! (:-))
>> You are trying to formulate some generic algorithm which does not work for
>> all index types.
>
> My algorithm should work for arrays, using properties of arrays.
> A'First .. A'Last, where A'First > A'Last works well in loops.
>
> When are you interested in computing the value half-way between
> the ends of a (non-numeric) enumeration type, attempting to use
> A'Length / 2?
Iteration algorithms in numeric analysis. Of course Length/2 is nonsense,
but (Xn+Xm)/2 or Xn+(Xm-Xn)/2 or its generalization G*(Xn+Xm) is used quite
often. For example, Xi can be from a vector space. G can be a matrix which
norm is 0.5.
>> This is why it is so important to have a consistent model
>> of indexing and arrays.
>
> It is important to be consistently using the proper type of arrays
> in algorithms made for this type of arrays.
>
>> For an unordered [index] type X it is wrong to
>> assume that:
>
> Can there be an index type in Ada that isn't ordered?
Sure:
type Unordered_Index is (A, B, C, D);
function "<" (Left, Right : Unordered_Index)
return Boolean is abstract;
type Unordered_Array is array (Unordered_Index) of Integer;
>> 1. If L in X and U in X then there is always M in X between L and U
>> 2. That M can be computed as (L+U)/2
>
> You can't usually compute M when X is an enumeration type.
> Otherwise, if A'Length <= 1, then (L+U)/2 = 0 = M.
> Thus, M can be computed but is not necessarily between L and U.
1. This is plain wrong. If L=U then (L+U)/2=L. In general, it is always so
that min(L,U) <= (L+U)/2 <= max(L,U), when ordered numbers are considered.
(For generalizations on unordered cases see "convex hull")
2. M could not be computed just because "+", "/", 2 aren't defined. Then of
course there could be no order;
3. Note that (1) is wrong for modular types. Not surprisingly, they aren't
numbers, but classes of equivalence (sets of numbers, infinite sets, BTW,
yet representable in the computer, how strange (:-)). As such they don't
posses the order of numbers. See "rings of congruence classes." Alas but,
here (modular types) Ada is again not very inconsistent.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2005-09-07 21:23 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-01 3:16 Surprise in array concatenation Gene
2005-09-01 7:55 ` Dmitry A. Kazakov
2005-09-01 8:02 ` Florian Weimer
2005-09-01 11:48 ` Georg Bauhaus
2005-09-01 12:02 ` Lutz Donnerhacke
2005-09-01 13:01 ` Georg Bauhaus
2005-09-01 15:54 ` Florian Weimer
2005-09-01 16:09 ` Robert A Duff
2005-09-05 8:38 ` Jean-Pierre Rosen
2005-09-05 23:52 ` Robert A Duff
2005-09-06 9:03 ` Jean-Pierre Rosen
2005-09-07 17:57 ` adaworks
2005-09-07 20:01 ` Robert A Duff
2005-09-08 8:08 ` Jacob Sparre Andersen
2005-09-07 22:46 ` Jeffrey Carter
2005-09-08 4:43 ` Simon Wright
2005-09-08 10:36 ` Georg Bauhaus
2005-09-08 13:47 ` Ed Falis
2005-09-08 17:03 ` Pascal Obry
2005-09-08 16:45 ` Jeffrey Carter
2005-09-08 19:37 ` Simon Wright
2005-09-08 6:32 ` adaworks
2005-09-08 9:09 ` Jean-Pierre Rosen
2005-09-08 16:56 ` Jeffrey Carter
2005-09-09 14:04 ` Bob Spooner
2005-09-09 16:17 ` adaworks
2005-09-23 23:04 ` Randy Brukardt
2005-09-14 8:57 ` Ole-Hjalmar Kristensen
2005-09-23 23:09 ` Randy Brukardt
2005-09-24 10:49 ` Larry Kilgallen
2005-09-24 20:27 ` Lurker
2005-09-25 0:20 ` Robert A Duff
2005-09-25 17:05 ` adaworks
2005-09-01 11:42 ` Georg Bauhaus
2005-09-01 13:59 ` Dmitry A. Kazakov
2005-09-01 15:36 ` Georg Bauhaus
2005-09-01 18:34 ` Dmitry A. Kazakov
2005-09-02 10:43 ` Georg Bauhaus
2005-09-02 13:11 ` Dmitry A. Kazakov
2005-09-02 14:23 ` Georg Bauhaus
2005-09-02 19:48 ` Dmitry A. Kazakov
2005-09-02 17:21 ` Björn Persson
2005-09-01 16:04 ` Robert A Duff
2005-09-01 18:06 ` Dmitry A. Kazakov
2005-09-02 10:42 ` Georg Bauhaus
2005-09-02 13:20 ` Dmitry A. Kazakov
2005-09-02 14:14 ` Georg Bauhaus
2005-09-02 19:48 ` Dmitry A. Kazakov
2005-09-03 20:01 ` Georg Bauhaus
2005-09-04 10:13 ` Dmitry A. Kazakov
2005-09-05 13:22 ` Georg Bauhaus
2005-09-05 15:50 ` Dmitry A. Kazakov
2005-09-05 18:20 ` Georg Bauhaus
2005-09-05 18:31 ` Georg Bauhaus
2005-09-06 8:20 ` Dmitry A. Kazakov
2005-09-06 11:52 ` Georg Bauhaus
2005-09-06 13:46 ` Dmitry A. Kazakov
2005-09-06 15:51 ` Georg Bauhaus
2005-09-06 21:32 ` Robert A Duff
2005-09-07 9:08 ` Dmitry A. Kazakov
2005-09-07 18:20 ` Georg Bauhaus
2005-09-07 19:07 ` Georg Bauhaus
2005-09-07 21:23 ` Dmitry A. Kazakov [this message]
2005-09-08 10:27 ` Georg Bauhaus
2005-09-08 11:39 ` Georg Bauhaus
2005-09-08 13:44 ` Dmitry A. Kazakov
2005-09-08 18:18 ` Georg Bauhaus
2005-09-09 10:06 ` Dmitry A. Kazakov
2005-09-09 12:26 ` Georg Bauhaus
2005-09-09 12:29 ` Georg Bauhaus
2005-09-01 8:48 ` Jean-Pierre Rosen
2005-09-01 15:57 ` Robert A Duff
2005-09-01 21:42 ` Gene
2005-09-01 22:56 ` tmoran
2005-09-05 15:53 ` Gene
2005-09-05 17:47 ` jimmaureenrogers
2005-09-05 22:13 ` Robert A Duff
2005-09-06 8:24 ` Dmitry A. Kazakov
2005-09-05 19:22 ` Jeffrey R. Carter
2005-09-05 21:54 ` Robert A Duff
2005-09-05 22:50 ` Larry Kilgallen
2005-09-05 23:46 ` Robert A Duff
2005-09-12 3:59 ` Dave Thompson
2005-09-06 16:02 ` Jeffrey Carter
2005-09-06 21:00 ` Robert A Duff
2005-09-06 5:38 ` Pascal Obry
2005-09-05 21:48 ` Robert A Duff
2005-09-06 5:25 ` tmoran
2005-09-06 14:58 ` Robert A Duff
2005-09-06 9:26 ` Georg Bauhaus
2005-09-06 15:00 ` Robert A Duff
2005-09-07 11:02 ` Thierry Pirot
2005-09-07 20:09 ` Robert A Duff
2005-09-06 13:22 ` Bob Spooner
2005-09-06 15:30 ` Robert A Duff
2005-09-06 16:12 ` Jeffrey Carter
2005-09-06 21:21 ` Robert A Duff
2005-09-02 20:19 ` Jeffrey R. Carter
2005-09-03 12:51 ` Dr. Adrian Wrigley
2005-09-03 14:08 ` Jacob Sparre Andersen
2005-09-05 8:34 ` Jean-Pierre Rosen
2005-09-05 9:32 ` Arrays indexed by fixed point types (Was: Surprise in array concatenation) Jacob Sparre Andersen
2005-09-05 11:07 ` Jean-Pierre Rosen
2005-09-05 15:12 ` Dr. Adrian Wrigley
2005-09-05 12:14 ` Dmitry A. Kazakov
2005-09-05 13:07 ` Jacob Sparre Andersen
2005-09-05 15:10 ` Dmitry A. Kazakov
2005-09-05 11:29 ` Surprise in array concatenation Dr. Adrian Wrigley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox