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

Edit detail for AldorForFriCAS revision 2 of 3

1 2 3
Editor: test1
Time: 2023/09/18 14:01:44 GMT+0
Note:

changed:
-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
to compile functions which you then can use from FriCAS.  Currently
the following commands work and install Aldor in '/opt/aldor':


    git clone https://github.com/aldorlang/aldor
    cd aldor/aldor
    ./configure --disable-maintainer-mode --prefix=/opt/aldor
    make > mlogg 2>&1
    make install

Note: Newest Aldor is available only from Git repository.  The '--disable-maintainer-mode'
option is needed to avoid failures due to mismatche autotools versions.

The FriCAS/Aldor interface is part of the current FriCAS

changed:
-which will compile a file libaxiom.al and thus make it possible to use the Aldor compiler for FriCAS.

which will compile a file libfricas.al and thus make it possible to use the Aldor compiler for FriCAS.

changed:
-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.
If Aldor is installed in a nonstandard place then use '--with-aldor-binary= option'.  And
of course you can combine the above with other FriCAS configure options.  So,
to build in directory 'fricas-build' parallel to source directory 'trunk',
enablibg GMP support and using Aldor binary from '/opt/aldor/bin/aldor' use:

  ../trunk/configure --enable-gmp --enable-aldor --with-aldor-binary=/opt/aldor/bin/aldor

Note: there were several changes in Aldor and FriCAS affecting the interface, older versions of Aldor
do not work with newest FriCAS, older versions of FriCAS do not work with newest Aldor.

It is possible to use Aldor interface on MathAction including FriCASWiki.
Instruction below describe how such usage is working.

changed:
-#include "axiom.as"
#include "fricas.as"

changed:
-Now call the function in Axiom as you would any other. First get the library
Now call the function in FriCAS as you would any other. First get the library

changed:
-#include "axiom.as"
#include "fricas.as"

changed:
-s := symmetricPart m
-a := antisymmetricPart m
s := symmetricPart(m)$MatrixSymmetry(Fraction(Integer))
a := antisymmetricPart(m)$MatrixSymmetry(Fraction(Integer))

removed:
-- [Interval Arithmetic]
-

changed:
-#include "axiom.as"
#include "fricas.as"

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

changed:
-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
see Issue # 229

It is possible to use the Aldor compiler WebSite:www.aldor.org to compile functions which you then can use from FriCAS?. Currently the following commands work and install Aldor in '/opt/aldor':

git clone https://github.com/aldorlang/aldor cd aldor/aldor ./configure --disable-maintainer-mode --prefix=/opt/aldor make > mlogg 2>&1 make install

Note: Newest Aldor is available only from Git repository. The --disable-maintainer-mode option is needed to avoid failures due to mismatche autotools versions.

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 libfricas.al and thus make it possible to use the Aldor compiler for FriCAS?. Of course, you must have the latest aldor compiler installed.

If Aldor is installed in a nonstandard place then use --with-aldor-binary= option. And of course you can combine the above with other FriCAS? configure options. So, to build in directory fricas-build parallel to source directory trunk, enablibg GMP support and using Aldor binary from /opt/aldor/bin/aldor use:

../trunk/configure --enable-gmp --enable-aldor --with-aldor-binary=/opt/aldor/bin/aldor

Note: there were several changes in Aldor and FriCAS? affecting the interface, older versions of Aldor do not work with newest FriCAS?, older versions of FriCAS? do not work with newest Aldor.

It is possible to use Aldor interface on MathAction? including FriCASWiki?. Instruction below describe how such usage is working.

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.

fricas
(1) -> <aldor>
#include "fricas.as"
fact(n: PositiveInteger): PositiveInteger == { n <= 1 => 1; res: PositiveInteger := 1; while n > 1 repeat { res := res * n; n := n-1; } res }</aldor>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/fact.as using
      Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
fricas
Compiling Lisp source code from file ./fact.lsp
   Issuing )library command for fact
fricas
Reading /var/aw/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 FriCAS? 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)

\label{eq1}39916800(1)
Type: PositiveInteger?
fricas
sqrt(fact(13))

\label{eq2}{1440}\ {\sqrt{3003}}(2)
Type: AlgebraicNumber?

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 "fricas.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/9220782423898255697-25px004.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./9220782423898255697-25px004.lsp
   Issuing )library command for 9220782423898255697-25px004
   Reading /var/aw/var/LatexWiki/9220782423898255697-25px004.asy
   MatrixSymmetry is now explicitly exposed in frame initial 
   MatrixSymmetry will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/9220782423898255697-25px004

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

\label{eq3}\left[ 
\begin{array}{cc}
{\frac{1}{2}}&{\frac{1}{3}}
\
{\frac{1}{4}}&{\frac{1}{5}}
(3)
Type: Matrix(Fraction(Integer))
fricas
s := symmetricPart(m)$MatrixSymmetry(Fraction(Integer))

\label{eq4}\left[ 
\begin{array}{cc}
{\frac{1}{2}}&{\frac{7}{24}}
\
{\frac{7}{24}}&{\frac{1}{5}}
(4)
Type: Matrix(Fraction(Integer))
fricas
a := antisymmetricPart(m)$MatrixSymmetry(Fraction(Integer))

\label{eq5}\left[ 
\begin{array}{cc}
0 &{\frac{1}{24}}
\
-{\frac{1}{24}}& 0 
(5)
Type: Matrix(Fraction(Integer))

See also the more complex examples:

  • [RandomAlgebra]?
  • [FormalFraction]?

More Examples

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

aldor
#include "fricas.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/5434963794726606939-25px006.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./5434963794726606939-25px006.lsp
   Issuing )library command for 5434963794726606939-25px006
   Reading /var/aw/var/LatexWiki/5434963794726606939-25px006.asy
   Test is now explicitly exposed in frame initial 
   Test will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5434963794726606939-25px006

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

  )co test.as

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

fricas
fact(5)$Test

\label{eq6}120(6)
Type: PositiveInteger?

Known Problems

see Issue # 229