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

Edit detail for AldorForFriCAS revision 1 of 3

1 2 3
Editor: test1
Time: 2018/02/25 17:35:22 GMT+0
Note:

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

- WebSite:www.aldor.org/docs/HTML/chap18.html

Support for domains and packages is now in the testing stage. The
FriCAS/Aldor interface is part of the current FriCAS
source distribution.  Ralf Hemmecke updated the work of Peter Broadbery
and integrated it into FriCAS.  In FriCAS you can now simply say::

  ./configure --enable-aldor && make && make install

which will compile a file libaxiom.al and thus make it possible to use the Aldor compiler for FriCAS.
Of course, you must have the latest aldor compiler installed.

There is just one issue left that is connected to either the Aldor compiler or FriCAS.
See 
"Issues":http://groups.google.com/group/fricas-devel/browse_thread/thread/727f3b35da110e6d/6e83c1aea4fcaed9#6e83c1aea4fcaed9
and links therein for more details.


It was possible to use Aldor interface on MathAction including FriCASWiki.
But current Aldor does not build on machine running FriCASWiki.
So, until the problem is resolved you can not use Aldor on this website.
Instruction below describe how such usage is supposed to work.

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.

\begin{aldor}[fact]
#include "axiom.as"

fact(n: PositiveInteger): PositiveInteger == {
    n <= 1 => 1;
    res: PositiveInteger := 1;
    while n > 1 repeat {
        res := res * n;
        n := n-1;
    }
    res
 }
\end{aldor}

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
\begin{axiom}
)lib fact
\end{axiom}

Now we test it:
\begin{axiom}
fact(11)
sqrt(fact(13))
\end{axiom}

If you care to, you can also look at the
"Aldor source":/images/fact.as
generated "lisp code":/images/fact.lsp and the final
"compiled result":/images/fact.asy

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

\begin{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)
\end{aldor}

\begin{axiom}
m := matrix[[1/2,1/3],[1/4,1/5]]
s := symmetricPart m
a := antisymmetricPart m
\end{axiom}

See also the more complex examples:

- [RandomAlgebra]

- [FormalFraction]

- [Interval Arithmetic]

More Examples

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

\begin{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 } }
\end{aldor}

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

  )co test.as

\begin{axiom}  
)sh Test
\end{axiom}

\begin{axiom}
fact(5)$Test
\end{axiom}

Known Problems

see Issue #219



Here is a precomputed <a href="http://axiom-wiki.newsynthesis.org/uploads/libaxiom.al">libaxiom.al</a> that has been produced with src_aldor2.tgz and FriCAS (rev 286).



From BillPage Mon Aug 1 08:28:48 -0700 2011
From: Bill Page
Date: Mon, 01 Aug 2011 08:28:48 -0700
Subject: Building the Aldor interface
Message-ID: <20110801082848-0700@axiom-wiki.newsynthesis.org>

This page is quite out of date. FriCAS configure now has an option::

 # configure --enable-aldor

If aldor is installed and working on your system, then the above
command will build the interface. I build FriCAS using SBCL but there
seems to be a problem introduced with the most recent release of
FriCAS, so you should use an earlier release such as::

  svn co https://fricas.svn.sourceforge.net/svnroot/fricas/releases/1.1.2 fricas-1.1.2

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

  • WebSite:www.aldor.org/docs/HTML/chap18.html

Support for domains and packages is now in the testing stage. The FriCAS?/Aldor interface is part of the current FriCAS? source distribution. Ralf Hemmecke updated the work of Peter Broadbery and integrated it into FriCAS?. In FriCAS? you can now simply say:

  ./configure --enable-aldor && make && make install

which will compile a file libaxiom.al and thus make it possible to use the Aldor compiler for FriCAS?. Of course, you must have the latest aldor compiler installed.

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

It was possible to use Aldor interface on MathAction? including FriCASWiki?. But current Aldor does not build on machine running FriCASWiki?. So, until the problem is resolved you can not use Aldor on this website. Instruction below describe how such usage is supposed to work.

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/lib/zope2.10/instance/axiom-wiki/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.
   The )library system command was not called after compilation.

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

fricas
)lib fact
fricas
Reading /var/aw/var/LatexWiki/fact.asy

Now we test it:

fricas
fact(11)
>> System error: #<SB-SYS:FD-STREAM for "file /var/aw/var/LatexWiki/fact.fasl" {1004A133B3}> is a fasl file compiled with SBCL 1.0.47, and can't be loaded into SBCL 1.1.1.

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/lib/zope2.10/instance/axiom-wiki/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.
   The )library system command was not called after compilation.

fricas
m := matrix[[1/2,1/3],[1/4,1/5]]

\label{eq1}\left[ 
\begin{array}{cc}
{1 \over 2}&{1 \over 3}
\
{1 \over 4}&{1 \over 5}
(1)
Type: Matrix(Fraction(Integer))
fricas
s := symmetricPart m
There are no library operations named symmetricPart Use HyperDoc Browse or issue )what op symmetricPart to learn if there is any operation containing " symmetricPart " in its name.
Cannot find a definition or applicable library operation named symmetricPart with argument type(s) Matrix(Fraction(Integer))
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

See also the more complex examples:

  • [RandomAlgebra]?
  • [FormalFraction]?
  • [Interval Arithmetic]?

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/lib/zope2.10/instance/axiom-wiki/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.
   The )library system command was not called after compilation.

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

  )co test.as

fricas
)sh Test
The )show system command is used to display information about types or partial types. For example, )show Integer will show information about Integer .
Test is not the name of a known type constructor. If you want to see information about any operations named Test , issue )display operations Test

fricas
fact(5)$Test
Test is not a valid type.

Known Problems

see Issue #219

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

Building the Aldor interface --Bill Page, Mon, 01 Aug 2011 08:28:48 -0700 reply
This page is quite out of date. FriCAS? configure now has an option:
 # configure --enable-aldor

If aldor is installed and working on your system, then the above command will build the interface. I build FriCAS? using SBCL but there seems to be a problem introduced with the most recent release of FriCAS?, so you should use an earlier release such as:

  svn co https://fricas.svn.sourceforge.net/svnroot/fricas/releases/1.1.2 fricas-1.1.2