axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Axiom-developer] Maxima on MathAction and Sage


From: Page, Bill
Subject: RE: [Axiom-developer] Maxima on MathAction and Sage
Date: Thu, 10 Aug 2006 18:16:42 -0400

Alfredo,

Yes, the \$ seems to be an artifact of Clisp or of the slightly
newer version of Maxima that you are using. I don't think that
your test necessarily demonstrates that this is the cause of the
current problem but it is something that you will have to deal
with later.

The test that I would like you to do is the follows:

Set up 3 text files like this:

$ cat xxx.max
1+1;
sin(x)^2;
---

$ cat yyy.max
integrate(sin(x),x);
---

$ cat max.in
batch("xxx.max");
batch("yyy.max");
batch("xxx.max");
quit();
---

Then run maxima like this:

$ /usr/local/bin/maxima \
   -p /var/zope/Products/LatexWiki/mathaction-maxima-5.9.3.lisp \
      < max.in > max.out

(modifying the paths appropriately).

Then send me the contents of the file 'max.out'

-------

These regexp either have to match *exactly* the prompt codes
that maxima sends or else you have to very carefully choose the
parts that are variable.

In the case of the \$ sequence in your example, I think that
is more likely to affect another regexp

    maximaOutPattern = re.compile(
        #r'<latex>.*?black\}(.*?)</latex>'              #1 LaTeX
        r'<latex>\\mbox{\\tt\\red\(\\mathrm{\\%(i\d+)}\)
\\black}(.*?)</latex>|'   #1 #2 Input
        r'<latex>\\mbox{\\tt\\red\(\\mathrm{\\%(o\d+)}\)
\\black}(.*?)</latex>|'   #3 #4 Output
        r'stdin:((?:.(?!<latex>))*.)',  #5 Other stuff
        reConsts)

This one is in ReplaceInlineMaxima.py. It's purpose is to classify
the contents of <latex> ... </latex> tags as either "input" or
"output" and to handle error messages. Note especially the

  \\mathrm{\\%

sequence which appears to differ from your results (no \$).
When reading Python string constants remember that you may have
to escape certain characters - in this case \, so \\ really
matches on one literal \ character.

So if \$ is present you may need to write:

  \\mathrm{\\\$\\%

You end up with 3 \\\ because you need 2 \\ to represent one \
and you need also to escape the $ special character.

Getting all this right can give you a headache... :-)

Regards,
Bill Page.
-------

On Thursday, August 10, 2006 5:17 PM Alfredo Portes wrote:
        
> Bill,
>       
> I hope this was the right test to do. On my box this is the
> output of passing  file with three commands to maxima and
> using the lisp file:
        
        
        <maxima>
        Maxima 5.9.3.99rc2 http://maxima.sourceforge.net
        Using Lisp CLISP 2.39 (2006-07-16)
        Distributed under the GNU Public License. See the file COPYING.
        Dedicated to the memory of William Schelter. 
        This is a development version of Maxima. The function
bug_report()
        provides bug reporting information.
        <prompt>(\mathrm{\$\%i}1)
</prompt><latex>\mbox{\tt\red(\mathrm{\$\%o1}) \black}4</latex> 
        <prompt>(\mathrm{\$\%i}2)
</prompt><latex>\mbox{\tt\red(\mathrm{\$\%o2}) \black}234310</latex>
        <prompt>(\mathrm{\$\%i}3)
</prompt><latex>\mbox{\tt\red(\mathrm{\$\%o3}) \black}625</latex> 
        <prompt>(\mathrm{\$\%i}4) </prompt></maxima>
        
        
> On axiom-developer running the same command on my directory is:
        
        
        <maxima>
        Maxima 5.9.3 http://maxima.sourceforge.net
        Using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka GCL)
        Distributed under the GNU Public License. See the file COPYING.
        Dedicated to the memory of William Schelter.
        This is a development version of Maxima. The function
bug_report() 
        provides bug reporting information.
        <prompt>(\mathrm{\%i}1)
</prompt><latex>\mbox{\tt\red(\mathrm{\%o1}) \black}4</latex>
        <prompt>(\mathrm{\%i}2)
</prompt><latex>\mbox{\tt\red(\mathrm{\%o2}) \black}234310</latex> 
        <prompt>(\mathrm{\%i}3)
</prompt><latex>\mbox{\tt\red(\mathrm{\%o3}) \black}625</latex>
        <prompt>(\mathrm{\%i}4) </prompt></maxima>
        

> The "\$\" appears only on my installation of maxima. I do
> not know if this matters. 
>       
> Please let me know, if not I will continue trying to look
> for a regex that works.
        




reply via email to

[Prev in Thread] Current Thread [Next in Thread]