From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f47e0c6e2e5fd00d X-Google-Attributes: gid103376,public From: "Howard W. LUDWIG" Subject: Re: Function name problem Date: 2000/01/18 Message-ID: <3884ADEA.C77EC14C@lmco.com>#1/1 X-Deja-AN: 574322103 Content-Transfer-Encoding: 7bit References: <85qecu$24r$1@nnrp1.deja.com> <85stib$a2g1@news.cis.okstate.edu> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii Organization: LMC Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-01-18T00:00:00+00:00 List-Id: "David C. Hoos, Sr." wrote: > > David Starner wrote in message > news:85stib$a2g1@news.cis.okstate.edu... > > On Sun, 16 Jan 2000 12:37:21 +0100, Harald Schmidt > wrote: > > >in article 85qecu$24r$1@nnrp1.deja.com, Jeff Carter at > > >jrcarter001@my-deja.com wrote on 15.01.2000 19:30: > > > > > > 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. > 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