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

# Edit detail for AldorForFriCAS revision 1 of 1

 1 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
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.
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}

- [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}

## 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
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