Axiom/FriCAS User Interfaces and Qt TeXmacs in Ubuntu

Updated March 24. This post was heavily edited because of new FriCAS version.

At last I’ve started learning Axiom (or FriCAS, its fork, they aren’t very different by now). The first difficulty one encounters in Axiom is that it has no GUI. For example trying to evaluate \displaystyle{\int \frac{1}{x^3 \sqrt[3]{a+bx}} \, dx} will lead you to the following result:

(1) -> integrate(1/(x**3 * (a+b*x)**(1/3)),x)

   (1)
           2 2 +-+    3+-+3+-------+2   3+-+2 3+-------+
       - 2b x \|3 log(\|a \|b x + a   + \|a   \|b x + a + a)
     +
         2 2 +-+    3+-+2 3+-------+
       4b x \|3 log(\|a   \|b x + a - a)
     +
                  +-+3+-+2 3+-------+    +-+
        2 2     2\|3 \|a   \|b x + a + a\|3                  +-+3+-+3+-------+2
     12b x atan(----------------------------) + (12b x - 9a)\|3 \|a \|b x + a
                             3a
  /
        2 2 +-+3+-+
     18a x \|3 \|a
                                         Type: Union(Expression(Integer),...)

I believe many newcomers to Axiom will consider reading ASCII formated output to be as hard as reading matrix digital rain. Fortunately, there are several ways to improve the output.

Improving console interface.

If you are running FriCAS you may issue )set output characters default to have a bit nicer output:

(1) -> integrate(1/(x**3 * (a+b*x)**(1/3)),x)

   (1)
           2 2 ┌─┐    3┌─┐3┌───────┐2   3┌─┐2 3┌───────┐         2 2 ┌─┐    3┌─┐2 3┌───────┐
       - 2b x \│3 log(\│a \│b x + a   + \│a   \│b x + a + a) + 4b x \│3 log(\│a   \│b x + a - a)
     +
                    ┌─┐3┌─┐2 3┌───────┐    ┌─┐
          2 2     2\│3 \│a   \│b x + a + a\│3                  ┌─┐3┌─┐3┌───────┐2
       12b x atan(────────────────────────────) + (12b x - 9a)\│3 \│a \│b x + a
                               3a
  /
        2 2 ┌─┐3┌─┐
     18a x \│3 \│a
                                                                                    Type: Union(Expression(Integer),...)

I also set output length to 120 since I usually have FriCAS window maximized. To make this commands applied at startup create .fricas.input file in your home directory. Put the following lines in it:

)set output characters default
)set output length 120

You may want to have something different instead of 120, choose the value you like more.

If you are having problems with Home, End, Delete keys, install rlwrap. Next time use the following command to run FriCAS:

rlwrap fricas -noclef

Same tip holds for Axiom.

FriCAS GUI.

There are two GUI’s for FriCAS. One of them, called efricas, is based on emacs. To run it issue a command of the same name:

efricas

Another solution to GUI problem is called TeXmacs. TeXmacs is not only a scientific editing platform, but also serves as a frontend to several CAS’s, including Axiom and since recently FriCAS.

However, there is no qt version of TeXmacs in Ubuntu repositories (likely there is no even a .deb package). The one that comes with Ubuntu 10.10 is using some ancient toolkit, so TeXmacs looks old-fashioned and its appearance is not really customizable. So you have to build texmacs-qt from sources.

Compiling TeXmacs with Qt.

First, download the sources and unpack them somewhere. Then, issue the following command in the unpacked TeXmacs directory:

./configure --with-freetype --enable-qt --with-cairo --with-imlib2 --with-qt

NOTE: You may want some extra options, like --prefix= to alter the installation directory, it’s all up to you.

Configure will check whether all required software is installed. If something is missing, it will print some error messages which will give you a clue what packages you should install to be able to build TeXmacs. After configuration is done you can start building:

make

and then installing:

sudo make install

TeXmacs should be ready for work with qt interface.

Axiom and TeXmacs.

TeXmacs should be capable of supporting Axiom out of the box, just do Insert -> Session -> Axiom within TeXmacs. But for some reason (no AXIOMsys in PATH?) Axiom from Ubuntu 10.10 repositories refuses to interact with TeXmacs, so I’ve downloaded it from the official site. And to make it work I had to to install libreadline v5 package. Nevertheless, after all these actions I have TeXmacs working well with Axiom.

Adding FriCAS support to TeXmacs.

TeXmacs support for FriCAS appeared not so long ago and still in its experimental stage. For more information I refer you to the mailing list. Download TeXmacs plugin and unpack it in ~/.TeXmacs/plugins/ directory. Then go to ~/.TeXmacs/plugins/fricas and issue make command.

Now you should be able to insert (Insert -> Session -> FriCAS) FriCAS session within TeXmacs-qt:

Fricas in TeXmacs

Advertisements
This entry was posted in FriCAS, Tips and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s