login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

It is possible to use the Aldor compiler WebSite:www.aldor.org to compile functions which you then can use Axiom. For details see:

Support for domains and packages is now in the testing stage. The Axiom/Aldor interface works with the open source version of Axiom (as of Patch-44) by Peter Broadbery. Thanks Peter! But note that the Aldor interface itself is not part of the current Axiom source distribution.

There is currently (August 2008) a branch in the FriCAS repository aldor-interface which builds an Aldor interface if at configure time the aldor binaries and some library (libfoam.al) are available. It works by:

  ./configure && make && make install

There is just one issue left that is connected to either the Aldor compiler or FriCAS. See Issues and links therein for more details.

A new version of Axiom based on axiom--main--1--Patch-44 and Peter's interface has been installed on MathAction including AxiomWiki. So you can use Aldor on this website.

For details about how to install the Axiom/Aldor interface, see below. Note: As of Patch-46, the aldor.diff patches have been included in the Axiom source distribution, but all other steps in building Axiom with Aldor still apply.

Aldor on MathAction

This is a simple example of how to use Aldor on MathAction.

To compile an Aldor function, for example this non-recursive method to compute a factorial, in MathAction the Aldor code appears between \begin{aldor}[fact] ... \end{aldor} tags on the edit page.

aldor
#include "axiom.as"
fact(n: PositiveInteger): PositiveInteger == { n <= 1 => 1; res: PositiveInteger := 1; while n > 1 repeat { res := res * n; n := n-1; } res }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/fact.as using AXIOM-XL compiler and 
      options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file ./fact.lsp
   Issuing )library command for fact
   Reading /var/zope2/var/LatexWiki/fact.asy

The optional [name] parameter is used to name the compiled library file which can be used later on another page in a )library command.

Now call the function in Axiom as you would any other. First get the library

axiom
)lib fact
axiom
Reading /var/zope2/var/LatexWiki/fact.asy

Now we test it:

axiom
fact(11)
LatexWiki Image(1)
axiom
sqrt(fact(13))
LatexWiki Image(2)

If you care to, you can also look at the Aldor source generated lisp code and the final compiled result

Here is an example from WebSite:www.aldor.org/docs/HTML/chap18.html

aldor
#include "axiom.as"
#pile
MatrixSymmetry(R:Field): with symmetricPart : Matrix R -> Matrix R ++ `symmetricPart(M)' returns a symmetric ++ matrix `S', computed as `(M + transpose M)/2'. ++ The difference `M - S' is antisymmetric.
antisymmetricPart : Matrix R -> Matrix R ++ `antisymmetricPart(M)' returns an antisymmetric ++ matrix `A', computed as `(M - transpose M)/2'. ++ The difference `M - A' is symmetric. == add import from R, Integer
symmetricPart(m: Matrix R): Matrix R == mt := transpose m inv(2::R) * (m + mt)
antisymmetricPart(m: Matrix R): Matrix R == mt := transpose m inv(2::R) * (m - mt)
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/2504912445765138530-25px004.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./2504912445765138530-25px004.lsp
   Issuing )library command for 2504912445765138530-25px004
   Reading /var/zope2/var/LatexWiki/2504912445765138530-25px004.asy
   MatrixSymmetry is now explicitly exposed in frame initial 
   MatrixSymmetry will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/2504912445765138530-25px004

axiom
m := matrix[[1/2,1/3],[1/4,1/5]]
LatexWiki Image(3)
Type: Matrix Fraction Integer
axiom
s := symmetricPart m
LatexWiki Image(4)
Type: Matrix Fraction Integer
axiom
a := antisymmetricPart m
LatexWiki Image(5)
Type: Matrix Fraction Integer

See also the more complex examples:

Building Axiom with Aldor

(preliminary instructions)

We plan to (re-)integrate the linkage of Axiom with the Aldor as an optional part of the Axiom build in the next release of Axiom 3 beta. Until then to build Axiom with Aldor support you must do the following:

  1. If you use wh-sandbox, build-improvements, FriCAS or Open-Axiom, you should follow the instructions on

    http://groups.google.at/group/fricas-devel/msg/86285212496f3545

  2. Make sure you have the most up to date version of gnu make from WebSite:savannah.gnu.org/projects/make.

    If not, then upgrade your version of make or linux first:

         $ make --version
         GNU Make 3.80
    

    Warning: GNU Make 3.81beta4, which seems to be the default on Kubuntu, does not work!

  3. Install the Java development kit JDK:

    WebSite:java.sun.com/j2se/1.5.0/download.jsp

    It may be necessary to adjust symbolic links or the PATH to point to the correct version of java:

         $ ls -l `which java`
         lrwxrwxrwx  1 root root 30 Jun  3 22:00 /usr/bin/java -> /usr/java/jre1.5.0_06/bin/java
         $ javac -version
         $ javac 1.5.0_06
    

  4. Download and install Aldor as described here:

    WebSite:www.aldor.org

    Be sure to set ALDORROOT and the PATH to Aldor properly for your system.

  5. Download Peter's Aldor interface make files here

    src_aldor2.tgz (Use Save as in your browser, in order to save a gzipped archive. Some browsers automatically unzip the file and store only a tar archive with extension .tgz.)

  6. Update your Axiom source code
  7. Now build a new version of Axiom
  8. Extract the Aldor make files:
         $ cd src
         $ tar xzvf ~/src_aldor2.tgz
    
       If your browser has already unzipped the archive, then leave out the z in the tar argument.
    
  9. Build the Aldor interface

    Issue the following commands:

         $ cd aldor
         $ document Makefile.pamphlet
         $ make
    

    make stops with an error message. The next two steps correct the problem:

         $ touch ../../int/aldor/dep_spad.stamp
         $ document Make.functions.pamphlet
    

    newer Axiom+Aldor combinations seem to have an additional problem, which is avoided by commenting out (using the "#" character) line 70 (the @false statement) in src/aldor/libaxiom.mk (Note that this is not a real fix, it just lets the build continue.) Also look at a discussion in the mailing list

    Now complete build of the Aldor interface:

         $ make 2>&1 | tee aldor.log
    

    The build might take up to 2 hours or some machines. There is some problem with the latex build in the Silver branch. So if you happen to see that your compilation stops, then just press ENTER twice.

  10. ( Finally, download and save the file ) Already included in recent version of Aldor

    axiom.as

    into aldor/1.0.2/linux/include/ of your aldor (binary) distribution.

    Congratulations! Now you should be able to compile Aldor files in Axiom.

  11. Save the fact example above into a file named fact.as
  12. Start Axiom
  13. Compile and run the example file:
          )co fact.as
          fact(5)
    

More Examples

Having put the following simple domain in a file test.as ::

aldor
#include "axiom.as"
Test: with { fact: PositiveInteger -> PositiveInteger } == add { fact(n: PositiveInteger): PositiveInteger == { n <= 1 => 1; res: PositiveInteger := 1; while n > 1 repeat { res := res * n; n := n-1; } res } }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/4005392542604933580-25px006.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./4005392542604933580-25px006.lsp
   Issuing )library command for 4005392542604933580-25px006
   Reading /var/zope2/var/LatexWiki/4005392542604933580-25px006.asy
   Test is now explicitly exposed in frame initial 
   Test will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/4005392542604933580-25px006

I compiled it with Aldor as above. In Axiom you should do:

  )co test.as

axiom
)sh Test
Test is a domain constructor Abbreviation for Test is TEST This constructor is exposed in this frame. ------------------------------- Operations -------------------------------- fact : PositiveInteger -> PositiveInteger

axiom
fact(5)$Test
LatexWiki Image(6)

Known Problems

see Issue #219

Here is a precomputed libaxiom.al that has been produced with src_aldor2.tgz and FriCAS (rev 286).




subject:
  ( 7 subscribers )  
Please rate this page: