comp.lang.ada
 help / color / mirror / Atom feed
From: "Howard W. LUDWIG" <howard.w.ludwig@lmco.com>
Subject: Re: Function name problem
Date: 2000/01/18
Date: 2000-01-18T00:00:00+00:00	[thread overview]
Message-ID: <3884ADEA.C77EC14C@lmco.com> (raw)
In-Reply-To: N7qg4.18$4R4.1827@newsread1.prod.itd.earthlink.net

"David C. Hoos, Sr." wrote:
> 
> David Starner <dvdeug@x8b4e53cd.dhcp.okstate.edu> wrote in message
> news:85stib$a2g1@news.cis.okstate.edu...
> > On Sun, 16 Jan 2000 12:37:21 +0100, Harald Schmidt
> <Harald.Schmidt@tomcat.de> wrote:
> > >in article 85qecu$24r$1@nnrp1.deja.com, Jeff Carter at
> > >jrcarter001@my-deja.com wrote on 15.01.2000 19:30:
> > >
> <snip>
> > it. If I could use Unicode in writing programs, I can see a few places
> > where mathematical symbols would make nice operators, but still,
> > a {dot symbol} b and a {cross symbol} b aren't superior enough to
> > Dot(a,b) and Cross (a, b) to make the precidence and readibility
> > problems worth it.
> Beside which, the parameter/return type profiles of dot product and
> cross product are unique, so you can just use the "*" operator
> for these.
> <snip>

For some applications this is acceptable.  However, I never use the "*" 
operator any more for vector-on-vector operators because there are too 
many applications I encounter where there is ambiguity, and it's easier 
to be consistent and always write the operation as a function with a 
spelled-out name.  (I do still use "*" for multiplying a scalar times a 
vector, though.)

The problems arise when one wants to do anything more than 
  S := U * W;
and
  V := U * W;
There are numerous other products of vectors important in various 
applications.  One example is the scalar triple product:
  S := Dot(U, Cross(V, W));
which one might like to write as 
  S := U * (V * W);
but is very confusing to compilers.  An ironic fact is that the mathematics 
enable one to shorten the notation to (U V W), meaning that a vector 
product of any two cyclically consecutive vectors followed by a scalar 
product of the remaining vector yields the same result.  Thus, if one 
were to write U * V * W, it would not matter (ignoring numerical analysis 
issues) which multiply was regarded as the cross product and which as the 
scalar product, as long as the vector product is done first--the compiler 
would go nuts (or at least claim you were nuts) when it wouldn't need to.  
(Note:  I am not advocating the dropping of parentheses in mathematics nor 
Ada for these sorts of expressions--precedence is important and ambiguity 
needs to be removed; the cross product is NOT associative, for example.)

Howard W. LUDWIG




  parent reply	other threads:[~2000-01-18  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-15  0:00 Function name problem Harald Schmidt
2000-01-15  0:00 ` Matthew Heaney
2000-01-15  0:00 ` Jeff Carter
2000-01-16  0:00   ` Harald Schmidt
2000-01-16  0:00     ` David Starner
2000-01-16  0:00       ` David C. Hoos, Sr.
2000-01-16  0:00         ` David Starner
2000-01-18  0:00         ` Howard W. LUDWIG [this message]
2000-01-16  0:00       ` David A. Cobb
2000-01-16  0:00         ` David Starner
2000-01-17  0:00           ` David A. Cobb
2000-01-17  0:00             ` David Starner
2000-01-17  0:00               ` Jeff Carter
2000-01-16  0:00     ` Matthew Heaney
2000-01-16  0:00       ` Harald Schmidt
2000-01-16  0:00         ` Gautier
2000-01-17  0:00         ` Matthew Heaney
2000-01-26  0:00       ` Florian Weimer
2000-01-15  0:00 ` Pascal Obry
replies disabled

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