On 2/06/2014 5:40 a.m., Bruno Le Floch wrote:
>> I had the experience recently of checking a complicated trigonometric
>> expression derived, after an embarrassingly long labour, from another
>> complicated trigonometric expression. Had I made a mistake in the
>> working? I evaluated the expressions using l3fp. One, for a number of
>> different parameter values gave 0, the other for the same parameter
>> values gave 0. I concluded, ruefully, that the derivation was correct.
> Note that \fp_compare:nTF { 0 = 0 } { true } { false } gives true, so
> you could just let l3fp compare the numbers. I have to say I'm
> surprised by that use of l3fp: I'd definitely use a general purpose
> programming language for that (e.g., python). Happy l3fp helps.
>
> Bruno
I use LyX. LyX has its instant preview facility, in particular for
maths. I'm revising a package (not publicly available yet, but I will at
some stage put a link to it on the LyX wiki) that turns wellformed
formed latex expressions like \tfrac{4}{3}\pi r^{3}, which are easy to
write in LyX's math editor, into "feedstock" for l3fp. Giving the
variables particular values, the result snaps into view "before one's
eyes". It's like having an upsidedown pile of used envelopes beside one
(only much faster) for numerically exploring formulas that are part of
the text (and therefore already written).
The main problem has centred around "juxtaposition = multiplication" and
the fact that juxtaposition has precedence over function calls so that
(for instance) exp(foo)(bah)(baa)(bar) in l3fp raises e to the power of
the product of foo and bah and baa and bar. This is most unlikely to be
what is intended in a mathematical argument and so my package inserts an
asterisk: \exp{foo}(bah) in latex becomes exp(foo)*(bah) for the l3fp
feedstock.
Andrew
