| Bill Allombert on Sun, 24 Jan 2016 14:13:04 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: gp-inline tests in a document |
On Sun, Jan 24, 2016 at 04:33:15PM +1100, Kevin Ryde wrote:
> In the unending battle against errors, I've been using gp to check
> formulas and sample values in TeX and elsewhere by writing test
> expressions as comments like "% GP-Test 2+2==4". A gp-inline script
> (Perl) extracts and executes.
>
> http://user42.tuxfamily.org/pari-gp-inline/index.html
>
> Tests in with the text help give some confidence to a claimed formula
> etc, especially if returning to the text later and being tempted to
> rearrange :-).
>
> There's a couple of lines of elisp for passing the expressions to
> pariemacs gp subprocess. That can be any comment too so handy for gp
> one-liners as experiments etc elsewhere, eg. in program code.
For what is worth, I often do
\catcode`*=13
\def*{\*}
in LaTeX document. This allow TeX to understand polynomial expression
in GP format directly, so you can do
\begin{equation}
D = B^2 - 4*A*C
\end{equation}
This reduce the risk of copy error.
Conversely I use a script to extract equations from the LaTeX file to
check them with GP.
Cheers,
Bill.