Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id sAO1DC3n000640 for ; Mon, 24 Nov 2014 02:13:13 +0100 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx005) with ESMTPS (Nemesis) id 0LkRqd-1YThn72oWJ-00cT24 for ; Mon, 24 Nov 2014 02:13:06 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id sAO1B3ne009477 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Nov 2014 02:11:03 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id sANN1468016048; Mon, 24 Nov 2014 02:11:02 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11486991 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 24 Nov 2014 02:11:00 +0100 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id sAO1B0DY023113 for ; Mon, 24 Nov 2014 02:11:00 +0100 Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id sAO1Abn2009031 for ; Mon, 24 Nov 2014 02:10:41 +0100 Received: from mxin2-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp3.clear.net.nz (CLEAR Net Mail) with ESMTP id <0NFI00F90R7ZBV60@smtp3.clear.net.nz> for LATEX-L@listserv.uni-heidelberg.de; Mon, 24 Nov 2014 14:10:35 +1300 (NZDT) Received: from 121-74-40-154.telstraclear.net (HELO [127.0.0.1]) ([121.74.40.154]) by smtpin2.clear.net.nz with ESMTP; Mon, 24 Nov 2014 14:10:18 +1300 MIME-version: 1.0 Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Antivirus: avast! (VPS 141120-1, 21/11/2014), Outbound message X-Antivirus-Status: Clean User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 Message-ID: <54728579.9060106@clear.net.nz> Date: Mon, 24 Nov 2014 14:10:17 +1300 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: aparsloe Subject: 1+1=2, calculyx, and musings on l3fp To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:bINs7hr3hkQ=:UWwumlKaWvHlPXC3R9EkmIkFb7 tHRkR4tYDhxowS2pAeBJXUW36FL0F97MtNNBnzcJZ3VgvK8xlxsuTz5S8CrYeoCj9rzqjT/Mw L703N5YJ+cYzIFon5MILHGlsgymqqpBPcyVRv0ivTmnH7/rVMFlZlNn7/r+AiDVW/DjyNRLjj k/gUGR5Y+Q+UKaV/hp0sBDXfrYuuoU3g4BPYEPhen0uqrXSuwDe+otClBavy+g0I2m0aXJDAW Za3kP7hIAH5TuJk1IjMbt5L07SCoDBqKqAQUafWBqpfDU8lc2SL8zzxsEOy9WTMFUpNuOZGb7 bWqq05XgqwZVL36YYeYgJ1skvQKMgjoA5FXPJuX7anSxsKUIXhHzr3x6jGacG+KiswuajIKhK IkbLUjMObZLCc1ng5bbeYDfHPbpmg/gZFkLyJHwmsV64ShhnBjZoqnhpjGxiiCVzlPm2M2WhM RbcvDSjYnkKcTZULYbn4h4NTbClCacZQ7HhdDZyJmaBWPX0OcYbMBMle2MtVy1Znx3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PQqKRcU= X-UI-Out-Filterresults: notjunk:1; X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7631 About a century ago in their "Principia Mathematica" Russell and Whitehead established, after enormous labour (p.379 apparently), that 1+1=2. It delights me that now, late in 2014, we can put this to the test and, indeed, confirm it: \fp_eval:n { .^. + .**. } The march of progress! Please view the preceding little joke as a pre-emptive strike. I have just "finished" a package called calculyx.sty. Among much else it makes use of this unusual deployment of the decimal point (specifically \fp_eval:n { . } ), and it would inconvenience me considerably were this to be prevented. Calculyx runs to about 3900 lines of code (but with many formatting lines). Considering that I had never managed more than 10 to 20 lines of TeX/LaTeX code before, it is a tribute to the enabling powers of expl3. I even began to feel that coding with expl3 was intuitive (god help me). The "roadmap" in interface3.pdf remarks of l3fp that "this module is mostly meant as an underlying tool for higher-level commands. For example, one could provide a function to typeset nicely the result of floating point computations." When I saw the calculation preceding the remark, I realised that it was "made to measure" for the instant preview facility in LyX. That is what I have done. One enters an expression in the LyX math editor, moves the cursor outside the editor, and after a (brief) pause, the calculation is effected and the answer snaps into view. As well as many modules from l3kernel, the package uses xparse from l3packages and l3regex from l3experimental. Because a main routine uses the command \clist_reverse:N, which was introduced to l3kernel on 18 July 2014, the version of l3kernel must be later than this. There is a link at http://wiki.lyx.org/Examples/Calculyx to a zipped archive currently in a Dropbox folder. I shall wait a while for any feedback before considering a more permanent location. I have tried to ensure as much as possible that calculyx reads expressions as mathematicians write them. For instance it will "digest" \sin 3x - 3\sin x + 4\sin^{3} x (for a specified value of x, say \pi/6) without parentheses around the arguments and with the superscript in the "wrong" but familiar place. The l3fp machinery is hidden from view. Although written specifically for LyX, the package can be used independently but one needs to bear in mind that it expects LyXian LaTeX. I think this amounts to the following conditions: superscripts and subscripts are *always* wrapped in braces and, for the limits on summation signs, product signs and integrals, the lower limit *always* precedes the upper (e.g. \sum_{n=1}^{7} ). The link https://www.dropbox.com/s/7djkyjs44bpraol/Screenshot%202014-11-24%2013.52.07.png?dl=0 gives a screenshot (.png format) of a one page LaTeX document illustrating some examples of calculations, and the resulting pdf. Calculyx will "digest" a number of functions not covered in l3fp. I have implemented the three principal hyperbolic functions and their inverses (with the -1 notation: \tanh^{-1} ), factorials (the ! notation -- and why on earth do mathematicians write it *after* the number it qualifies?), binomial coefficients, gcd, sums and products, including "infinite" sums and products, limits, derivatives (1st & 2nd order) and definite integrals in a single variable. I found the pull from one function to the next irresistible. Having implemented sums (and products), it's hard not to consider factorials and binomial coefficients, and doubly hard to resist the siren song of infinite sums. Infinite sums lead naturally to limits generally, and it is then only a small step to derivatives, and you can hardly have derivatives without also having integrals. In fact I began to feel that there is a tension in l3fp, as if it is caught between two forces: one, a restrictive force limiting the set of functions to those appropriate to l3kernel, the other an expansionary pull of the kind I experienced. What does the kernel need? Let me display my ignorance: the four arithmetic functions, integral powers, and square roots. That covers things like scaling of fonts and paper sizes, calculation of margins, and most shaped paragraphs. But the l3fp roadmap mentions things like factorials, the gamma function(!), arrays, complex numbers. Yes please, but in the kernel? I am deeply thankful for what Bruno has already provided but can't help thinking that the module should "go the whole hog" and implement everything (so to speak). To my mind that would fit much more naturally as a full-blown LaTeX package (in l3packages?). Andrew