comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Dimensionality Checking (Ada 20XX)
Date: 12 Dec 2001 09:16:21 -0500
Date: 2001-12-12T14:19:29+00:00	[thread overview]
Message-ID: <upu5kjzgq.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 9v6iv7$dcrbf$2@ID-25716.news.dfncis.de

"Nick Roberts" <nickroberts@adaos.worldonline.co.uk> writes:

> "Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
> news:u7krtl5u8.fsf@gsfc.nasa.gov...
> 
> > F returns a position vector (x, y, z), in meters. So I'm not clear
> > what this should be.
> 
> Something like:
> 
> 
>    V := F(...);
>    A := ( Joint_Angle(V.X), Joint_Angle(V.Y), Joint_Angle(V.Z) );
> 
> 
> That's all.

Well, V is _not_ a vector of "angles", it is a vector of "Cartesian
positions". I guess you should do:

V := F (...);
M := Cartesian_Position (V);

Where Cartesian_Position does some scaling. 

But I repeat, I see no advantage here. I can easily and efficiently
define F to return a vector of meters.

> > as someone else pointed out, these three choices are orthogonal.
> 
> I'm not arguing about that. It would be nice to provide the facility for
> floating point numbers, I don't deny it. I just think it would be hard,
> that's all. But if it's needed, then it's needed.

Huh? Why would it be harder for float than fixed?

> > I still think you'll get an explosion of types, like Meters,
> > Meters_Squared, Meters_Per_Second, Meters_Per_Second_Squared. How
> > else do you specify the dimensions?
> 
> This is correct (you'll get a lot of types, one for each unit, which
> encompases a dimensionality and a scaling factor).
> 
> > So you'll still have to define
> > all the inter-type operations. I suppose you define some sort of
> > automatic operator generation for this, but that's an even bigger change.
> 
> Many (most?) of the required inter-type operations will be provided as
> predefined operations. This in itself is not a big change, since Ada 95
> already provides it!

Um, no. In Ada 95, I can do:

type Meters is digits ...;
type Seconds is digits ...;
type Meters_Per_Second is digits ...;

Ada 95 does _not_ define the following, which is needed:

function "/" (Left : in Meters; Right in Seconds) return
Meters_Per_Second;

Ada 95 _does_ define the following, which is wrong:

function "*" (Left, Right : in Meters) return Meters;


Now, if you are defining a new language feature, it would be really
good to get this right. Maybe something like:

type Meters is units digits ...;
type Seconds is units digits ...;
type Meters_Per_Second is units compose Meters / Seconds;

Then the compiler will _not_ generate multiply and divide operations
for "units" types, but _will_ automatically generate the appropriate
ones for "units compose" types.

I just made this up, so there's probably lots of holes in it.

> > > Angles are dimensionless, as you correctly point out, but so is
X (it is > a > > > ratio).
> >
> > Well, you said you would convince me of that, but I don't see any
> > argument for making X a ratio. I defined it as meters. I could pick
> > some arbitrary length (say the length of the robot forearm), and
> > define all other lengths in terms of that. But that would be horribly
> > confusing! What's wrong with meters for X?
> 
> See other posts in this thread. X must be 'dimensionless' in the sense of
> having dimensions of all 0.

If X is to be passed to a transcendental function, yes, it must be
dimensionless. But that's _not_ what I'm doing with X! I am _defining_
the position of the end of a robot arm to be V == (x, y, z). By
_definition_, x, y, and z are in meters. As such, it is _meaningless_
to pass x to a transcendental function. That's fine; the mathematical
meaninglessness simply reflects a physical meaninglessness. There is
no meaninful physical operation that corresponds to Sin (meters).

-- 
-- Stephe



  reply	other threads:[~2001-12-12 14:16 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-07  0:09 Dimensionality Checking (Ada 20XX) Snodgrass, Britt (NM75)
2001-12-07 16:15 ` Ian
2001-12-09 17:58   ` Nick Roberts
2001-12-09 22:58     ` Nick Roberts
2001-12-10  0:17     ` Mark Lundquist
2001-12-10  1:51       ` James Rogers
2001-12-10  3:33         ` Nick Roberts
2001-12-10 19:09           ` Nick Roberts
2001-12-11  8:20             ` Thomas Koenig
2001-12-11 15:37               ` Nick Roberts
2001-12-11 20:18                 ` Thomas Koenig
2001-12-12  0:58                   ` Mark Lundquist
2001-12-12  8:19                     ` Wilhelm Spickermann
2001-12-12 14:21                     ` Stephen Leake
2001-12-12 19:10                       ` Nick Roberts
2001-12-13 19:04                         ` Stephen Leake
2001-12-13 22:56                           ` Nick Roberts
2001-12-14  0:11                             ` Nick Roberts
2001-12-14 22:14                       ` Mark Lundquist
2001-12-15  1:30                         ` Nick Roberts
2001-12-10 20:22         ` Thomas Koenig
2001-12-10 17:21       ` Wes Groleau
2001-12-10 19:51         ` Mark Lundquist
2001-12-10 19:56           ` Wes Groleau
2001-12-10 20:37             ` Mark Lundquist
2001-12-10 18:56       ` Nick Roberts
2001-12-11 15:05         ` Wes Groleau
2001-12-11 16:39         ` Stephen Leake
2001-12-11 19:05           ` Nick Roberts
2001-12-11 22:50             ` Mark Johnson
2001-12-12  1:59               ` Nick Roberts
2001-12-11 23:01             ` Stephen Leake
2001-12-12  2:21               ` Nick Roberts
2001-12-12 14:16                 ` Stephen Leake [this message]
2001-12-13 19:52                   ` Nick Roberts
2001-12-13 22:22                     ` Nick Roberts
2001-12-14  6:40                       ` Robert C. Leif, Ph.D.
2001-12-14 17:30                       ` Stephen Leake
2001-12-14 17:38                     ` Stephen Leake
2001-12-11 22:45           ` Mark Lundquist
2001-12-12  1:42             ` Nick Roberts
2001-12-12 15:17               ` Mark Lundquist
2001-12-12 14:03             ` Stephen Leake
2001-12-12  9:35           ` Dmitry A. Kazakov
2001-12-12 14:26             ` Stephen Leake
2001-12-13 17:02               ` daniele andreatta
2001-12-13 19:06                 ` Stephen Leake
2001-12-14 10:16                 ` Dmitry A. Kazakov
2001-12-14 22:01                   ` Nick Roberts
2001-12-17 11:10                     ` Dmitry A. Kazakov
2001-12-17 12:16                       ` Thomas Koenig
2001-12-17 14:30                         ` Dmitry A. Kazakov
2001-12-27 17:18                         ` Steven Deller
2001-12-15  7:07                   ` Steven Deller
2001-12-17 12:31                     ` Dmitry A. Kazakov
2001-12-17 13:46                       ` Thomas Koenig
2001-12-17 15:00                         ` Dmitry A. Kazakov
2001-12-17 16:38                         ` Thomas Koenig
2001-12-17 21:07                       ` Britt Snodgrass
2001-12-20 13:44                         ` Dmitry A. Kazakov
2001-12-13 19:33         ` Mark Lundquist
2001-12-13 22:15           ` Nick Roberts
2001-12-14 20:20             ` Mark Lundquist
2001-12-10 23:31       ` Mark Lundquist
2001-12-10 13:57     ` Ian
2001-12-10 17:24       ` Wes Groleau
2001-12-10 20:38       ` Britt Snodgrass
  -- strict thread matches above, loose matches on Subject: below --
2001-12-11 13:11 Mike Brenner
2001-12-11 17:03 ` Mark Lundquist
2001-12-02 16:01 Another Idea for Ada 20XX James Rogers
2001-12-03 14:56 ` Mark Lundquist
2001-12-03 15:12   ` Lutz Donnerhacke
2001-12-03 21:13     ` Dimensionality Checking (Ada 20XX) Nick Roberts
2001-12-04 14:00       ` Dmitry A. Kazakov
2001-12-06 19:52         ` Britt Snodgrass
2001-12-06 20:55           ` Mark Lundquist
2001-12-06 22:38           ` Wes Groleau
2001-12-06 23:12             ` Mark Lundquist
2001-12-07 14:36               ` Wes Groleau
2001-12-07  9:37           ` Dmitry A. Kazakov
2001-12-07 22:51           ` Mark Lundquist
replies disabled

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