Discussion: new operators for numerical computation
Konrad Hinsen
hinsen at cnrs-orleans.fr
Thu Jul 20 05:12:44 EDT 2000
More information about the Python-list mailing list
Thu Jul 20 05:12:44 EDT 2000
- Previous message (by thread): Discussion: new operators for numerical computation
- Next message (by thread): Discussion: new operators for numerical computation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Huaiyu Zhu <huaiyu_zhu at yahoo.com> writes: > Here's a list of issues that come to mind: > > 1. What symbols to use. > > It seems that we can more or less concentrate on using either . or @ > together with existing math operators. Issues: There might be more options in the not too far future. With the general move towards Unicode, a Python interpreter that takes Unicode input files does not seem unreasonable. This would give access to plenty of new symbols which 1) do not cause any clashes with existing syntax 2) look like symbols used in paper-based math If I remember correctly, the APL symbol set is somewhere in Unicode. I agree that this proposal is not a realistic one for the immediate future, but I still like it ;-) > (1) Use . or @ For purely esthetic reasons, I wouldn't want to have @ in operators. The dot is fine but there are conflicts with floating point constants. But there are other alternatives. How about operators in parentheses? a (*) b looks fine to me, and it is currently illegal so it can't cause compatibility problems. I'd even claim that it somewhat *looks* like a matrix operation. One could take this a step further and introduce operator composition, like in APL. In APL, the inner product (of which the matrix product and the vector dot product are special cases) is written +.x (with a special multiplication operator that is not the same as the letter x). This means elementwise multiplication followed by reduction with plus. Other binary operators can be substituted, and some such combinations are quite useful. So we could introduce "operator expressions" like (+.*) for inner product, and then leave (*) for the outer product, with * remaining the elementwise product, as in NumPy. (/) could be matrix "division", or inversion when used as a unary operator. There should be plenty of combinations to make everyone happy. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------------
- Previous message (by thread): Discussion: new operators for numerical computation
- Next message (by thread): Discussion: new operators for numerical computation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list