File: [local] / OpenXM / src / asir-doc / parts / risa.texi (download)
Revision 1.14, Wed Mar 30 10:53:28 2005 UTC (19 years, 4 months ago) by takayama
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, KNOPPIX_2006, DEB_REL_1_2_3-9 Changes since 1.13: +5 -1
lines
ASIR_LIBDIR and ASIR_CONTRIB_DIR will become obsolete.
|
@comment $OpenXM: OpenXM/src/asir-doc/parts/risa.texi,v 1.14 2005/03/30 10:53:28 takayama Exp $
@node Risa/Asir,,, Top
@chapter Risa/Asir
@menu
\BJP
* Risa $B$*$h$S(B Asir::
* Asir $B$NFCD'(B::
* Installation::
* $B%3%^%s%I%i%$%s%*%W%7%g%s(B::
* $B4D6-JQ?t(B::
* $B5/F0$+$i=*N;$^$G(B::
* $B3d$j9~$_(B::
* $B%(%i!<=hM}(B::
* $B7W;;7k2L$*$h$SFC<l$J?t(B::
\E
\BEG
* Risa and Asir::
* Features of Asir::
* Installation::
* Command line options::
* Environment variable::
* Starting and Terminating an Asir session::
* Interruption::
* Error handling::
* Referencing results and special numbers::
\E
@end menu
\BJP
@node Risa $B$*$h$S(B Asir,,, Risa/Asir
@section Risa $B$*$h$S(B Asir
\E
\BEG
@node Risa and Asir,,, Risa/Asir
@section @b{Risa} and @b{Asir}
\E
@noindent
\BJP
@b{Risa} $B$O(B, $BIY;NDL8&$G3+H/Cf$N?t<0=hM}%7%9%F%`(B/$B%i%$%V%i%j$NAm>N$G$"$k(B.
@b{Risa} $B$N9=@.$O<!$NDL$j$G$"$k(B.
\E
\BEG
@b{Risa} is the name of whole libraries of a computer algebra system
which is under development at FUJITSU LABORATORIES LIMITED.
The structure of @b{Risa} is as follows.
\E
@itemize @bullet
@item
\JP @code{$B4pK\1i;;It(B}
\EG @b{The basic algebraic engine}
@*
\BJP
$B$3$l$O(B, @b{Risa} $B$NFbIt7A<0$KJQ49$5$l$?%*%V%8%'%/%H(B ($B?t(B, $BB?9`<0$J$I(B)
$B$N4V$N1i;;$r<B9T$9$kItJ,$G$"$j(B, UNIX $B$N(B @samp{libc.a} $B$J$I$HF1MM$N(B, $B%i%$%V%i(B
$B%j$H$7$FB8:_$9$k(B. $B%(%s%8%s$O(B, C $B$*$h$S(B $B%"%;%s%V%i$G5-=R$5$l(B, $B8e=R$9$k(B
$B8@8l%$%s%?%U%'!<%9(B @b{Asir} $B$N4pK\1i;;It$H$7$FMQ$$$i$l$F$$$k(B.
@comment $B0lJ}(B, $B?t<07W;;$rI,MW$H$9$k$5$^$6$^$J%W%m%0%i%`Cf$K%j%s%/$7$FMQ$$$k$3$H$,$G$-$k(B.
\E
\BEG
This is the part which performs basic algebraic operations,
such as arithmetic operations, to algebraic objects, e.g., numbers and
polynomials, which are already converted into internal forms.
It exists, like @samp{libc.a} of UNIX, as a library of ordinary UNIX system.
The algebraic engine is written mainly in C language and
partly in assembler.
It serves as the basic operation part of @b{Asir}, a standard
language interface of @b{Risa}.
@comment It can also be linked to various programs that need some symbolic
@comment and algebraic computation.
\E
@item
\JP @code{$B%a%b%j4IM}It(B}
\EG @b{Memory Manager}
@*
\BJP
@b{Risa} $B$G$O(B, $B%a%b%j4IM}It$H$7$F(B, @code{[Boehm,Weiser]} $B$K$h$k%U%j!<(B
$B%=%U%H%&%'%"(B (@code{gc-6.1alpha5}) $B$rMQ$$$F$$$k(B. $B$3$l$O%,!<%Y%8%3%l%/%7%g%s(B
($B0J2<(B GC $B$H8F$V(B) $B$r<+F0E*$K9T$&%a%b%j3d$jEv$F5!9=$r;}$A(B, @b{Risa} $B$N3F(B
$BItJ,$O$9$Y$F$3$l$K$h$jI,MW$J%a%b%j$rF@$F$$$k(B.
\E
\BEG
@b{Risa} employs, as its memory management component (the memory
manager), a free software distributed by Boehm (@code{gc-6.1alpha5}).
It is proposed by @code{[Boehm,Weiser]}, and developed by Boehm and
his colleagues.
The memory manager has a memory allocator which automatically
reclaims garbages, i.e., allocated but unused memories,
and refreshes them for further use.
The algebraic engine gets all its necessary memories through the memory
manager.
\E
@item
@b{Asir}
@*
\BJP
@b{Asir} $B$O(B, @b{Risa} $B$N7W;;%(%s%8%s$N8@8l%$%s%?%U%'!<%9$G(B
$B$"$k(B. @b{Risa} $B$G$O(B, $BHf3SE*MF0W$K%f!<%6MQ$N8@8l%$%s%?%U%'!<%9$r:n$k(B
$B$3$H$,$G$-$k(B. @b{Asir} $B$O$=$N0l$D$NNc$H$7$F:n$C$?$b$N$G(B, C $B8@8l$K6a(B
$B$$J8K!$r$b$D(B. $B$^$?(B, C $B$N%G%P%C%,$H$7$F9-$/MQ$$$i$l$F$$$k(B @code{dbx} $BIw(B
$B$N%G%P%C%,$bHw$($F$$$k(B.
\E
\BEG
@b{Asir} is a standard language interface of @b{Risa}'s algebraic
engine. It is one of the possible language interfaces, because
one can develop one's own language interface easily on @b{Risa}
system.
@b{Asir} is an example of such language interfaces.
@b{Asir} has very similar syntax and semantics as C language.
Furthermore, it has a debugger that provide a subset of commands of
@code{dbx}, a widely used debugger of C language.
\E
@end itemize
\BJP
@node Asir $B$NFCD'(B,,, Risa/Asir
@section Asir $B$NFCD'(B
\E
\BEG
@node Features of Asir,,, Risa/Asir
@section Features of @b{Asir}
\E
@noindent
\BJP
@b{Asir} $B$O(B, $BA0=R$NDL$j(B, $B7W;;%(%s%8%s$N8@8l%$%s%?%U%'!<%9$G$"(B
$B$k(B. $BDL>o(B @b{Asir} $B$H$$$&L>A0$N<B9T2DG=%U%!%$%k$H$7$FDs6!$5$l$k(B.
$B8=:_%5%]!<%H$5$l$F$$$k5!G=$O35$M<!$NDL$j$G$"$k(B.
\E
\BEG
As mentioned in the previous section, @b{Asir} is a standard language
interface for@b{Risa}'s algebraic engine.
Usually, it is provided as an executable file named @code{asir}.
Main features supported for the current version of Asir is as follows.
\E
@itemize @bullet
\BJP
@item
C $B8@8lIw$N%f!<%68@8l(B
@item
$B?t(B, $BB?9`<0(B, $BM-M}<0$N2C8:>h(B($B=|(B)
@item
$B%Y%/%H%k(B, $B9TNs$N1i;;(B
@item
$B:G>.8B$N%j%9%H=hM}(B
@item
$BAH$_9~$_H!?t(B ($B0x?tJ,2r(B, GCD, $B%0%l%V%J4pDl$J$I(B)
@item
$B%f!<%6Dj5AH!?t$K$h$k%D!<%k(B ($BBe?tBN>e$N0x?tJ,2r$J$I(B)
@item
@code{dbx} $BIw$N%G%P%C%,(B
@item
$B1"H!?t$NIA2h(B
@item
@b{PARI} (@pxref{pari}) $B$K$h$k=iEyD61[H!?t$r4^$`<0$NI>2A(B
@item
UNIX $B>e$G$NJ,;67W;;5!G=(B (Open XM)
@comment @item
@comment $B%R%9%H%jCV495!G=$r$b$D(B X11 $B%$%s%?%U%'!<%9(B
\E
\BEG
@item
A C-like programming language
@item
Arithmetic operations (addition, subtraction, multiplication
and division) on numbers, polynomials and rational expressions
@item
Operations on vectors and matrices
@item
List processing operations at the minimum
@item
Several Built-in functions (factorization, GCD computation, Groebner basis
computation etc.)
@item
Useful user defined functions(e.g., factorization over algebraic number fields)
@item
A @code{dbx}-like debugger
@item
Plotting of implicit functions
@item
Numerical evaluation of mathematical expressions including elementary
transcendental functions at arbitrary precision. This feature is
in force only if @b{PARI} system (@pxref{pari}).
@item
Distributed computation over UNIX
\E
@end itemize
@node Installation,,, Risa/Asir
@section Installation
\JP $B0J2<$N<jB3$-$GITL@$JE@(B, $BITET9g$JE@$,$"$C$?>l9g$NLd$$9g$o$;$O(B
\BEG
Any questions and any comments on this manual are welcome by e-mails
to the following address.
\E
@example
noro@@math.kobe-u.ac.jp
@end example
@noindent
\JP $B08$K(B e-mail $B$G$*4j$$$7$^$9(B.
@menu
* UNIX binary version::
* UNIX source code version::
* Windows version::
@end menu
@node UNIX binary version,,, Installation
@subsection UNIX binary version
@noindent
\BJP
$B%?!<%2%C%H(B CPU/OS $B$KBP1~$9$k(B @samp{asir.tgz} $B$,I,MW$G$"$k(B.
$B$3$l$i$OA4$F(B @code{gzip} $B$G05=L$7$F$"$k$N$G(B, $BF~<j8e(B @code{gzip} $B$G(B
$BE83+$9$k(B. $B$^$:(B, $B%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r7h$a$k(B. $B%G%U%)%k%H$G$O(B
@samp{/usr/local/lib} $B$K(B @samp{asir} $B$H$$$&%G%#%l%/%H%j$H$7$F(B
$B%$%s%9%H!<%k$5$l$k$3$H$r2>Dj$7$F$$$k(B. $B0J2<$3$N%G%#%l%/%H%j$r%i%$%V%i%j(B
$B%G%#%l%/%H%j$H8F$V(B.
\E
\BEG
A file @samp{asir.tgz} suitable for the target machine/architecture
is required. After getting it,
you have to unpack it by @code{gzip}. First of all, determine
a derectory where binaries and library files are installed.
We call the directory the @b{library directory}.
The following installs the files in @samp{/usr/local/lib/asir}.
\E
@example
# gzip -dc asir.tgz | ( cd /usr/local/lib; tar xf - )
@end example
\JP $B8D?ME*$K;HMQ$9$k>l9g$K$O(B, @samp{$HOME}$B$J$I$KCV$$$F$b$h$$(B.
\BEG
In this case you don't have to set any environment variable.
You can install them elsewhere.
\E
@example
% gzip -dc asir.tgz | ( cd $HOME; tar xf - )
@end example
@noindent
\BJP
$B$3$N>l9g(B, $B%i%$%V%i%j%G%#%l%/%H%j$NL>A0$r4D6-JQ?t(B
@code{ASIR_LIBDIR} $B$K@_Dj$9$kI,MW$,$"$k(B.
\E
\BEG
In this case you have to set the name of the library directory
to the environment variable @code{ASIR_LIBDIR}.
\E
@example
% setenv ASIR_LIBDIR $HOME/asir
@end example
@noindent
\BJP
Asir $BK\BN$O(B, $B%i%$%V%i%j%G%#%l%/%H%j$N(B @samp{asir} $B$G$"$k(B.
@samp{/usr/local/bin} $B$"$k$$$O%f!<%6$N<B9T%U%!%$%k%5!<%A%Q%9(B
$B$N$I$3$+$K%7%s%\%j%C%/%j%s%/$r:n$k$HJXMx$G$"$k(B.
\E
\BEG
@b{Asir} itself is in the library directory. It will be convenient
to create a symbolic link to it from @samp{/usr/local/bin} or
the user's search path.
\E
@example
# ln -s /usr/local/lib/asir/asir /usr/local/bin/asir
@end example
@noindent
\JP $B$3$l$G(B @samp{asir} $B$,5/F0$G$-$k(B.
\BEG
Then you can start @samp{asir}.
\E
@example
% /usr/local/bin/asir
This is Risa/Asir, Version 20000821.
Copyright (C) FUJITSU LABORATORIES LIMITED.
1994-2000. All rights reserved.
[0]
@end example
@node UNIX source code version,,, Installation
@subsection UNIX source code version
\BEG
First of all you have to determine the install directory.
In the install directory, the following subdirectories are put:
\E
\BJP
$B$^$:(B, $B%$%s%9%H!<%k@h$N%G%#%l%/%H%j$r7h$a$kI,MW$,$"$k(B.
$B$3$3$K$O(B, $B0J2<$N%5%V%G%#%l%/%H%j$,CV$+$l$k(B.
\E
@itemize @bullet
@item bin
\EG executables of PARI and Asir
\JP PARI $B$*$h$S(B Asir $B$N<B9T2DG=%U%!%$%k(B
@item lib
\EG library files of PARI and Asir
\JP PARI $B$*$h$S(B Asir $B$N%i%$%V%i%j(B
@item include
\EG header files of PARI
\JP PARI $B$N%X%C%@%U%!%$%k(B
@end itemize
\BEG
These subdirectories are created automatically if they does not exist.
If you can be a root, it is recommended to set the install directory
to @samp{/usr/local}. In the following the directory is denoted by TARGETDIR.
\E
\BJP
$B$3$l$i$N%5%V%G%#%l%/%H%j$OL5$1$l$P<+F0E*$K:n$i$l$k(B.
root $B8"8B$,$"$k>l9g$K$O(B, @samp{/usr/local} $B$K%$%s%9%H!<%k$9$k$3$H$r(B
$B$*4+$a$9$k(B. $B0J2<(B, $B$3$N%G%#%l%/%H%j$r(B TARGETDIR $B$H=q$/(B.
\E
\BEG
Then, install PARI library. After getting @samp{pari.tgz},
unpack and install it as follows:
\E
\BJP
$B$^$:(B PARI $B%i%$%V%i%j$r%$%s%9%H!<%k$9$kI,MW$,$"$k(B.
@samp{pari.tgz} $B$rF~<j8e(B, $BE,Ev$J%G%#%l%/%H%j$GE83+(B, $B%$%s%9%H!<%k$9$k(B.
\E
@example
% gzip -dc pari.tgz | tar xvf -
% cd pari
% ./Configure --prefix=TARGETDIR
% make all
% su
# make install
# make install-lib-sta
@end example
\BJP
make $BCf$K%(%i!<$G;_$^$C$?$i(B, $B0J2<$r<B9T$9$k(B.
\E
\BEG
While executing 'make install', the procedure may stop due to
some error. Then try the following:
\E
@example
% cd Oxxx
% make lib-sta
% su
# make install-lib-sta
# make install-include
# exit
%
@end example
\BEG
In the above example, xxx denotes the name of the target operating system.
Although GP is not built, the library necessary for building asir2000
will be generated.
After getting @samp{asir2000.tgz}, unpack it
and install necessary files as follows.
\E
\BJP
$B>e$NNc$G(B, xxx $B$O8=:_%?!<%2%C%H$H$J$C$F$$$k(B OS $B$NL>A0$r<($9(B.
GP $B$O%$%s%9%H!<%k$5$l$J$$$,(B, asir2000 $B$N:n@.$KI,MW$J%U%!%$%k$O%$%s%9%H!<%k(B
$B$5$l$k(B.
@samp{asir2000.tgz} $B$rF~<j8e(B, $BE,Ev$J%G%#%l%/%H%j$G(B
$B$GE83+$7(B, $B0J2<$N<j=g$G%$%s%9%H!<%k$9$k(B.
\E
@example
% gzip -dc asir.tgz | tar xf -
% cd asir2000
% ./configure --prefix=TARGETDIR --with-pari --enable-plot
% make
% su
# make install
# make install-lib
# make install-doc
# exit
@end example
@node Windows version,,, Installation
@subsection Windows version
@noindent
\BJP
$BI,MW$J%U%!%$%k$O(B @samp{asirwin-ja.tgz} $B$G$"$k(B. $BB>$K(B, @samp{gzip.exe},
@samp{tar.exe} $B$,I,MW$@$,(B, @samp{asirwin-ja.tgz} $B$HF1$8%G%#%l%/%H%j$KMQ0U$7$F(B
$B$"$k(B. $B$3$l$i(B 3 $B$D$N%U%!%$%k$rF10l%G%#%l%/%H%j$K$*$-(B, $B%3%^%s%I%W%m%s%W%H(B
(DOS $B%W%m%s%W%H(B)
$B$+$i(B
\E
\BEG
The necessary file is @samp{asirwin-en.tgz}. To unpack it @samp{gzip.exe}
and @samp{tar.exe} are necessary. They are in the same
directory as @samp{asirwin-en.tgz} on the ftp server.
Putting them in the same directory, execute the following:
\E
@example
\JP C:\...> tar xzf asirwin.tgz
\EG C:\...> tar xzf asirwin.tgz
@end example
@noindent
\BJP
$B$r<B9T$9$l$P(B, @samp{Asir} $B$H$$$&%G%#%l%/%H%j(B (Asir $B%k!<%H%G%#%l%/%H%j(B)
$B$,$G$-$k(B.
@comment 990831 $BHG$G$O(B, GUI $B$HK\BN$,J,N%$5$l(B, $B$^$?%G%P%C%0%&%#%s%I%&$b(B
@comment $BJL%W%m%;%9$H$7$F(B GUI $B$,8F$S=P$5$l$k$?$a(B, Asir $B%k!<%H%G%#%l%/%H%j$,@5$7$/(B
@comment $BEPO?$5$l$F$$$k$3$H$,I,MW$G$"$k(B.
Asir $B%k!<%H%G%#%l%/%H%j$N%5%V%G%#%l%/%H(B
@samp{bin} $B$K(B @samp{asirgui.exe} (GUI), @samp{engine.exe} ($BK\BN(B) $B$,(B
$BCV$+$l$F$$$k(B.
@samp{asirgui.exe} $B$r%@%V%k%/%j%C%/$9$l$P(B Asir $B$,N)$A>e$,$k(B.
@comment @samp{asirgui.exe} $B$N=i2s$NN)$A>e$2$O(B, $B%(%/%9%W%m!<%i$+$i9T(B
@comment $B$&(B. $B$3$l$K$h$j(B
\E
\BEG
Then a directory @samp{Asir} (@b{Asir root directory}) is created,
which has subdirectories named @samp{bin} and @samp{lib}.
Asir can be invoked by double-clicking @samp{asirgui.exe}.
@comment To set up it,
@comment invoke @samp{bin\asirgui.exe} from Explorer and
@comment click @code{OK}. Then the name of @b{Asir root directory} is set to the
@comment following registries.
\E
@comment @example
@comment \JP HKEY_LOCAL_MACHINE\SOFTWARE\FUJITSU\Asir\99.03.31\Directory
@comment \EG HKEY_LOCAL_MACHINE\SOFTWARE\FUJITSU\Asir\99.03.31\Directory
@comment @end example
@comment @noindent
@comment \JP $B$H$$$&%l%8%9%H%j$K(B Asir $B%k!<%H%G%#%l%/%H%j$,@5$7$/EPO?$5$l$k(B.
\BJP
@node $B%3%^%s%I%i%$%s%*%W%7%g%s(B,,, Risa/Asir
@section $B%3%^%s%I%i%$%s%*%W%7%g%s(B
\E
\BEG
@node Command line options,,, Risa/Asir
@section Command line options
\E
@noindent
\JP $B%3%^%s%I%i%$%s%*%W%7%g%s$O<!$NDL$j(B.
\EG Command-line options for the command @samp{asir} are as follows.
@table @code
@item -heap @var{number}
\BJP
@code{Risa/Asir} $B$G$O(B, 4KB $B$N%V%m%C%/$r%a%b%j3d$jEv$F$NC10L$H$7$FMQ$$$F$$$k(B.
$B%G%U%)%k%H$G$O(B, $B=i4|(B heap $B$H$7$F(B, 16 $B%V%m%C%/(B (64KB) $B3d$jEv$F$k$,(B, $B$=$l(B
$B$rJQ99$9$k>l9g(B, @code{-heap} $B$rMQ$$$k(B. $BC10L$O%V%m%C%/$G$"$k(B.
heap $B$NBg$-$5$O(B, @code{heap()} $BH!?t$GD4$Y$k$3$H$,$G$-$k(B ($BC10L$O%P%$%H(B).
\E
\BEG
In @b{Risa/Asir}, 4KB is used as an unit, called block,
for memory allocation.
By default, 16 blocks (64KB) are allocated initially.
This value can be changed by giving an option @code{-heap}
a number parameter in unit block.
Size of the heap area is obtained by a Built-in function heap(),
the result of which is a number in Bytes.
\E
@item -adj @var{number}
\BJP
$B$3$NCM$,Bg$-$$$[$I(B, $B;HMQ%a%b%jNL$OBg$-$/$J$k$,(B, GC $B;~4V$,>/$J$/$J(B
$B$k(B. @var{number} $B$H$7$F(B 1 $B0J>e$N@0?t$,;XDj$G$-$k(B. $B%G%U%)%k%H$G$O(B 3 $B$G$"(B
$B$k(B. $B$3$NCM$,(B 1 $B0J2<$K$J$k$H(B GC $B$r$7$J$$@_Dj$K$J$k$N$GMWCm0U$G$"$k(B. heap
$B$r$J$k$Y$/?-$P$5$:$K(B, GC $B$r<gBN$K$7$F%a%b%j4IM}$7$?$$>l9g$K$O(B, $B$3$NCM$r(B
$BBg$-$/(B ($BNc$($P(B 8) $B@_Dj$9$k(B.
\E
\BEG
Heap area will be stretched by the memory manager,
if the size of reclaimed memories is less than 1/@var{number}
of currently allocated heap area.
The default value for @var{number} is 3.
If you do not prefer to stretch heap area by some reason, perhaps by
restriction of available memories, but if prefer to resort to
reclaiming garbages as far as possible,
then a large value should be chosen for @var{number}, e.g., 8.
\E
@item -norc
\JP $B=i4|2=%U%!%$%k(B @samp{$HOME/.asirrc} $B$rFI$^$J$$(B.
\BEG
When this option is specified, @b{Asir} does not read the
initial file @samp{$HOME/.asirrc}.
\E
@item -quiet
\JP $B5/F0;~$NCx:n8"I=<($r9T$o$J$$(B.
\BEG Be quiet at boot time.
\E
@item -f @var{file}
\BJP
$BI8=`F~NO$NBe$o$j$K(B, @var{file} $B$+$iF~NO$rFI$_9~$s$G<B9T$9$k(B.
$B%(%i!<$N:]$K$O$?$@$A$K=*N;$9$k(B.
\E
\BEG
Instead of the standard input, @var{file} is used as the input.
Upon an error, the execution immediately terminates.
\E
@item -paristack @var{number}
\BJP
@b{PARI} (@pxref{pari}) $B@lMQ$NNN0h$NBg$-$5$r;XDj$9$k(B. $BC10L$O%P%$%H(B. $B%G%U%)(B
$B%k%H$G$O(B 1 MB.
\E
\BEG
This option specifies the private memory size for @code{PARI} (@pxref{pari}).
The unit is Bytes. By default, it is set to 1 MB.
\E
@item -maxheap @var{number}
\BJP
heap $BNN0h$N>e8B$r;XDj$9$k(B. $BC10L$O%P%$%H(B. $B%G%U%)%k%H$G$OL5@)8B(B. UNIX $B$N(B
$B>l9g(B, $B<B:]$K$O(B @code{limit} $B%3%^%s%I$GI=<($5$l$k(B @code{datasize} $B$NCM(B
$B$K@)8B$5$l$F$$$k$?$a(B, @code{-maxheap} $B$N;XDj$,$J$/$F$b0lDjNL0J>e$K(B
heap $B$r3MF@$G$-$J$$>l9g$,$"$k$N$GCm0U(B.)
\E
\BEG
This option sets an upper limit of the heap size. The unit is Bytes.
Note that the size is already limited by the value of @code{datasize}
displayed by the command @code{limit} on UNIX.
\E
@end table
\BJP
@node $B4D6-JQ?t(B,,, Risa/Asir
@section $B4D6-JQ?t(B
\E
\BEG
@node Environment variable,,, Risa/Asir
@section Environment variable
\E
@noindent
\BJP
@b{Asir} $B$N<B9T$K4X$9$k$$$/$D$+$N4D6-JQ?t$,B8:_$9$k(B. UNIX $B>e$G$O4D6-JQ?t(B
$B$O(B shell $B$N%3%^%s%I%i%$%s$+$iD>@\@_Dj$9$k$+(B, shell $B$N(B rc $B%U%!%$%k$G@_Dj(B
$B$9$k(B. Windows NT $B$G$O(B, [$B@_Dj(B]->[$B%7%9%F%`(B]->[$B4D6-(B] $B$G@_Dj$9$k(B. Windows 95/98
$B$G$O(B, @samp{c:\autoexec.bat} $B$K=q$$$F(B reboot $B$9$k(B.
\E
\BEG
There exist several environment variables concerning with an execution
of @b{Asir}. On UNIX, an environment variable is set from shells, or
in rc files of shells. On Windows NT, it can be set from [Control Panel]
->[Environment]. On Windows 95/98, it can be set in @samp{c:\autoexec.bat}.
Note that the setting takes effect after rebooting the machine on Windows
95/98.
\E
@itemize @bullet
@item
@code{ASIR_LIBDIR}
@*
\BJP
@b{Asir} $B$N%i%$%V%i%j%G%#%l%/%H%j(B, $B$9$J$o$A%f!<%68@8l$G=q$+$l$?%U%!%$%k(B
$B$J$I$,$*$+$l$k%G%#%l%/%H%j(B. $B;XDj$,$J$$>l9g(B UNIX $BHG$G$O(B
@samp{/usr/local/lib/asir}, Windows $BHG$G$O(B Asir $B%a%$%s%G%#%l%/%H%j$N2<$N(B
@samp{lib} $B%G%#%l%/%H%j$,MQ$$$i$l$k(B.
$B$3$N4D6-JQ?t$O(B @code{ASIRLOADPATH} $B$KE}9g$5$lGQ;_$5$l$kM=Dj(B.
\E
\BEG
The library directory of @b{Asir}, i.e., the directory where
, for example, files containing programs written in @b{Asir}.
If not specified, on UNIX, @samp{/usr/local/lib/asir} is used by default.
On Windows, @samp{lib} in @b{Asir root directory} is used by default.
This environment will be useful in a case where @b{Asir} binaries
are installed on a private directory of the user.
This environmental variable will become obsolete.
\E
@item
@code{ASIR_CONTRIB_DIR}
@*
\BJP
@b{Asir} $B$N(B asir-contrib $B%G%#%l%/%H%j(B, $B$9$J$o$A(B OpenXM/asir-contrib
$B%W%m%8%'%/%H$G=q$+$l$?%Q%C%1!<%8$d%G!<%?$J$I$,$*$+$l$k%G%#%l%/%H%j(B.
$B;XDj$,$J$$>l9g(B UNIX $BHG$G$O(B
@samp{/usr/local/lib/asir-contrib},
Windows $BHG$G$O(B Asir $B%a%$%s%G%#%l%/%H%j$N2<$N(B @samp{lib-asir-contrib}
$B%G%#%l%/%H%j$,MQ$$$i$l$k(B.
$B$3$N4D6-JQ?t$O(B @code{ASIRLOADPATH} $B$KE}9g$5$lGQ;_$5$l$kM=Dj(B.
This environmental variable will become obsolete.
\E
\BEG
The asir-contrib library directory of @b{Asir}, i.e., the directory where
packages and data developed by the OpenXM/asir-contrib project files are put.
If not specified, on UNIX, @samp{/usr/local/lib/asir-contrib}
is used by default.
On Windows, @samp{lib-asir-contrib} in @b{Asir root directory}
is used by default.
This environment will be useful in a case where @b{Asir} binaries
are installed on a private directory of the user.
\E
@item
@code{ASIRLOADPATH}
@*
\BJP
$B%m!<%I$5$l$k%U%!%$%k$,$"$k%G%#%l%/%H%j$r(B UNIX $B$N>l9g(B ':',
Windows$B$N>l9g(B ';' $B$G6h@Z$C$FJB$Y$k(B. $B%G%#%l(B
$B%/%H%j$O:8$+$i=g$K%5!<%A$5$l$k(B. $B$3$N;XDj$,$J$$>l9g(B, $B$*$h$S;XDj$5$l$?(B
$B%U%!%$%k$,(B @code{ASIRLOADPATH} $B$K$J$+$C$?>l9g(B, $B%i%$%V%i%j%G%#%l%/%H%j(B
$B$b%5!<%A$5$l$k(B.
\E
\BEG
This environment specifies directories which contains files to be
loaded by @b{Asir} command @code{load()}.
Directories are separated by a `:' on UNIX, a ';' on Windows respectively.
The search order is from the left to the right.
After searching out all directories in @code{ASIRLOADPATH},
or in case of no specification at all,
the library directory will be searched.
\E
@item
@code{HOME}
@*
\BJP
@var{-norc} $B%*%W%7%g%s$D$-$G5/F0$7$J$$>l9g(B, @samp{$HOME/.asirrc}$B$,$"$l$P(B,
$BM=$a$3$N%U%!%$%k$r<B9T$9$k(B. @code{HOME} $B$,@_Dj$5$l$F$$$J$$>l9g(B, UNIX $BHG(B
$B$G$O$J$K$bFI$^$J$$$,(B, Windows $BHG$G$O(B Asir $B%a%$%s%G%#%l%/%H%j(B
(@code{get_rootdir()} $B$GJV$5$l$k%G%#%l%/%H%j(B) $B$N(B @samp{.asirrc} $B$rC5$7(B,
$B$"$l$P$=$l$r<B9T$9$k(B.
\E
\BEG
If @b{Asir} is invoked without @var{-norc}, @samp{$HOME/.asirrc}, if exists,
is executed. If @code{HOME} is not set, nothing is done on UNIX. On Windows,
@samp{.asirrc} in @b{Asir root directory} is executed if it exists.
\E
@end itemize
\BJP
@node $B5/F0$+$i=*N;$^$G(B,,, Risa/Asir
@section $B5/F0$+$i=*N;$^$G(B
\E
\BEG
@node Starting and Terminating an Asir session,,, Risa/Asir
@section Starting and Terminating an @b{Asir} session
\E
@noindent
\JP @b{Asir} $B$r5/F0$9$k$H(B,
\BEG
Run @b{Asir}, then the copyright notice and the first prompt
will appear on your screen,
and a new @b{Asir} session will be started.
\E
@example
[0]
@end example
@noindent
\BJP
$B$J$k%W%m%s%W%H$,I=<($5$l(B, $B%;%C%7%g%s$,3+;O$9$k(B. @samp{$HOME/.asirrc}
(Windows $BHG$N>l9g(B, @code{HOME} $B@_Dj$5$l$F$$$J$$>l9g$K$O(B @code{get_rootdir()}
$B$GJV$5$l$k%G%#%l%/%H%j$K$"$k(B @samp{.asirrc})
$B$,B8:_$7$F$$$k>l9g(B, $B$3$N%U%!%$%k$r(B @b{Asir} $B%f!<%68@8l$G$+$+$l$?(B
$B%U%!%$%k$H8+$J$7(B, $B2r<a<B9T$9$k(B.
\E
\BEG
When initialization file @samp{$HOME/.asirrc} exists,
@b{Asir} interpreter executes it at first taking it as a program
file written in @b{Asir}.
\E
@noindent
\BJP
$B%W%m%s%W%H$OF~NO$NHV9f$rI=$9(B. $B%;%C%7%g%s$O(B, @code{end;} $B$^$?$O(B
@code{quit;} $B$rF~NO$9$k$3$H$K$h$j=*N;$9$k(B. $BF~NO$O(B, @samp{;} $B$^$?$O(B
@samp{$} $B$^$G$r0l6h@Z$j$H$7$FI>2A$5$l$k(B. @samp{;} $B$N$H$-7k2L$OI=<($5$l(B,
@samp{$} $B$N$H$-I=<($5$l$J$$(B.
\E
\BEG
The prompt indicates the sequential number of your input commands to
@b{Asir}.
The session will terminate when you input @code{end;} or @code{quit;}
to @b{Asir}.
Input commands are evaluated statement by statement.
A statement normally ends with its terminator
@samp{;} or @samp{$}.
(There are some exceptions. See, syntax of @b{Asir}.)
The result will be displayed when the command, i.e. statement,
is terminated by a @samp{;},
and will not when terminated by a @samp{$}.
\E
@example
% asir
[0] A;
0
[1] A=(x+y)^5;
x^5+5*y*x^4+10*y^2*x^3+10*y^3*x^2+5*y^4*x+y^5
[2] A;
x^5+5*y*x^4+10*y^2*x^3+10*y^3*x^2+5*y^4*x+y^5
[3] a=(x+y)^5;
evalpv : invalid assignment
return to toplevel
[3] a;
a
[4] fctr(A);
[[1,1],[x+y,5]]
[5] quit;
%
@end example
@noindent
\BJP
$B$3$NNc$G$O(B, @code{A}, @code{a}, @code{x}, @code{y} $B$J$kJ8;z$,;HMQ$5$l$F$$$k(B.
@code{A} $B$O%W%m%0%i%`$K$*$1$kJQ?t$G(B, @code{a}, @code{x}, @code{y} $B$O?t3XE*(B
$B$J0UL#$G$NITDj85$G$"$k(B. $B0lHL$K%W%m%0%i%`JQ?t$OBgJ8;z$G;O$^$j(B,
$BITDj85$O>.J8;z$G;O$^$k(B. $B$3$NNc$G$o$+$k$h$&$K(B, $B%W%m%0%i%`JQ?t$O(B,
$B?t(B, $B<0$J$I$r3JG<$7$F$*$/$?$a$N$b$N$G$"$j(B, C $B8@8l$J$I$K$*$1$kJQ?t$KBP1~$9$k(B.
$B0lJ}(B, $BITDj85$O$=$l<+?H$GCM$r;}$D$3$H$O$G$-$:(B, $B=>$C$F(B, $BITDj85$KBP$9$k(B
$BBeF~$O5v$5$l$J$$(B. $B8e$K<($9$,(B, $BITDj85$KBP$9$kBeF~$O(B, $BAH$_9~$_H!?t(B @code{subst()}
$B$K$h$jL@<(E*$K9T$o$l$k(B.
\E
\BEG
In the above example, names @code{A}, @code{a}, @code{x} and @code{y}
are used to identify mathematical and programming objects.
There, the name @code{A} denotes a program variable
(some times called simply as a program variable.)
while the other names, @code{a}, @code{x} and @code{y}, denote
mathematical objects, that is, indeterminates.
In general, program variables have names which begin with
capital letters, while names of indeterminates begin with
small letters.
As you can see in the example, program variables are used to hold and
keep objects, such as numbers and expressions, as their values,
just like variables in C programming language.
Whereas, indeterminates cannot have values so that assignment to
indeterminates are illegal.
If one wants to get a result by substituting a value for an indeterminate
in an expression, it is achieved by the function @code{subst} as the
value of the function.
\E
\BJP
@node $B3d$j9~$_(B,,, Risa/Asir
@section $B3d$j9~$_(B
\E
\BEG
@node Interruption,,, Risa/Asir
@section Interruption
\E
@noindent
\BJP
$B7W;;$r<B9TCf$K3d$j9~$_$r$+$1$?$$>l9g(B, $B3d$j9~$_%-%c%i%/%?(B($BDL>o$O(B
@kbd{C-c}, Windows, DOS $BHG$G$O(B @kbd{C-x} $B$rF~NO$9$k(B.
\E
\BEG
To interrupt the @b{Asir} execution, input an interrupt character
from the keyboard. A @kbd{C-c} is usually used for it.
(Notice: @kbd{C-x} on Windows and DOS.)
\E
@example
@@ (x+y)^1000;
@kbd{C-c}interrupt ?(q/t/c/d/u/w/?)
@end example
@noindent
\JP $B3FA*Br;h$N0UL#$O<!$NDL$j(B.
\EG Here, the meaning of options are as follows.
@table @code
\BJP
@item q
@b{Asir} $B$r=*N;$9$k(B. ($B3NG'$"$j(B)
@item t
$B%H%C%W%l%Y%k$KLa$k(B. ($B3NG'$"$j(B)
@item c
$B<B9T$r7QB3$9$k(B.
@item d
$B%G%P%C%0%b!<%I$KF~$k(B. $B%G%P%C%,$K4X$7$F$O(B @xref{$B%G%P%C%,(B}.
@item u
@code{register_handler()} (@pxref{ox_reset ox_intr register_handler}) $B$GEPO?$5$l$?(B
$B4X?t$r<B9T8e%H%C%W%l%Y%k$KLa$k(B. ($B3NG'$"$j(B)
@item w
$BCfCGE@$^$G$NH!?t$N8F$S=P$7Ns$rI=<($9$k(B.
@item ?
$B3FA*Br;h$N0UL#$r@bL@$9$k(B.
\E
\BEG
@item q
Terminates @b{Asir} session. (Confirmation requested.)
@item t
Returns to toplevel. (Confirmation requested.)
@item c
Resumes to continue the execution.
@item d
Enters debugging mode at the next statement of the @b{Asir} program,
if @b{Asir} has been executing a program loaded from a file.
Note that it will sometimes take a long time before entering
debugging mode when @b{Asir} is executing basic functions in the
algebraic engine, (e.g., arithmetic operation, factorization etc.)
Detailed description about the debugger will be given in @ref{Debugger}.
@item u
After executing a function registered by @code{register_handler()}
(@pxref{ox_reset ox_intr register_handler}), returns to toplevel. A confirmation
is prompted.
@item w
Displays the calling sequence up to the interruption.
@item ?
Show a brief description of options.
\E
@end table
\BJP
@node $B%(%i!<=hM}(B,,, Risa/Asir
@section $B%(%i!<=hM}(B
\E
\BEG
@node Error handling,,, Risa/Asir
@section Error handling
\E
@noindent
\BJP
$BAH$_9~$_H!?t$KIT@5$J7?$N0z?t$rEO$7$?>l9g$J$I$K$O<B9T$,CfCG$5$l$k$,(B,
$B%f!<%6H!?t$NCf$G%(%i!<$,5/$-$?>l9g$K$O%H%C%W%l%Y%k$KLa$kA0$K<+F0E*$K%G%P%C%0(B
$B%b!<%I$KF~$k(B. $B$3$N>uBV$G(B
$B%(%i!<$N>l=j(B, $BD>A0$N0z?t$NCM$J$I$rD4$Y$k$3$H$,$G$-$k(B.
$BI=<($5$l$k%(%i!<%a%C%;!<%8$O$5$^$6$^$G$"$j(B, $BFbIt$NH!?tL>$K0z$-B3$$$F(B
$B%a%C%;!<%8$,I=<($5$l$k(B. $B$3$l$O(B, $B8F$S=P$5$l$?AH$_9~$_H!?t(B
$B$HI,$:$7$bBP1~$O$7$J$$(B.
\E
\BEG
When arguments with illegal types are given to a built-in function,
an error will be detected and the execution will be quit.
In many cases, when an error is detected in a built-in function,
@b{Asir} automatically enters debugging mode before coming back
to toplevel.
At that time, one can examine the state of the program,
for example, inspect argument values just before the error occurred.
Messages reported there are various depending on cases. They are
reported after the internal function name. The internal function name
sometimes differs from the built-in function name that is specified by
the user program.
\E
@noindent
\BJP
$B$=$NB>(B, $B$5$^$6$^$J860x$K$h$jFbIt1i;;H!?t$K$*$$$F%(%i!<$,@8$:$k$3$H$,(B
$B$"$k(B. UNIX $BHG$N>l9g(B, $B$3$l$O<!$N$$$:$l$+$N(B
@code{internal error} $B$H$7$FJs9p$5$l(B, $BDL>o$N%(%i!<$HF1MM$K07$C$F(B,
$B%G%P%C%0%b!<%I$KF~$k(B.
\E
\BEG
In the execution of internal functions, errors may happen by various
reasons. The UNIX version of @b{Asir} will report those errors as one of
the following @code{internal error}'s, and enters debugging mode just
like normal errors.
\E
@table @code
@item SEGV
@itemx BUS ERROR
@*
\BJP
$BAH$_9~$_H!?t$K$h$C$F$O(B, $B0z?t$N7?$r87L)$K%A%'%C%/$;$:$K1i;;%k!<%A%s$K0z(B
$B$-EO$7$F$7$^$&$b$N$bB8:_$7$F$$$k(B. $B$3$N$h$&$J>u67$K$*$$$F(B,
$BIT@5$J%]%$%s%?(B, $B$"$k$$$O(B NULL $B%]%$%s%?$K$h$k%"%/%;%90cH?$,$"$C$?>l9g(B, $B$3$l$i(B
$B$N%(%i!<$H$J$k(B.
\E
\BEG
Some of the built-in functions transmit their arguments to internal
operation routines without strict type-checking. In such cases,
one of these two errors will be reported
when an access violation caused by an illegal pointer or a NULL pointer
is detected.
\E
@item BROKEN PIPE
@*
\BJP
$B%W%m%;%94VDL?.$K$*$$$F(B, $BAj<j@h$N%W%m%;%9$H$N4V$N%9%H%j!<%`(B
$B$,4{$KB8:_$7$F$$$J$$>l9g(B ($BNc$($P4{$KAj<j@h$N%W%m%;%9$,=*N;$7$F$$$k>l9g$J$I(B)
$B$K(B, $B$=$N%9%H%j!<%`$KF~=PNO$7$h$&$H$7$?>l9g$K$3$N%(%i!<$H$J$k(B.
\E
\BEG
In the process communication, this error will be reported if a process
attempts to read from or to write onto the partner process when the
stream to the partner process does not already exist, (e.g., terminated
process.)
\E
@end table
@noindent
\BJP
$B$3$l$i$O<B:]$K$O(B, $BAH$_9~$_H!?t$NF~8}$K$*$$$F(B, $B0z?t$r40A4$K%A%'%C%/(B
$B$9$k$3$H$K$h$jBgItJ,$OKI$2$k$,(B, $B<j4V$,B?$/$+$+$k$3$H$H(B, $B>l9g$K(B
$B$h$C$F$O8zN($rMn$9$3$H$K$b$J$k$?$a(B, $B$"$($F0z?t%A%'%C%/$O%f!<%6(B
$BG$$;$K$7$F$"$k(B.
\E
\BEG
For UNIX version, even in such a case, the process itself does not
terminate because such an error can be caught by @code{signal()} and
recovered.
To remove this weak point, complete type
checking of all arguments are indispensable at the entry of a built-in
function, which requires an enormous amount of re-making efforts.
\E
\BJP
@node $B7W;;7k2L$*$h$SFC<l$J?t(B,,, Risa/Asir
@section $B7W;;7k2L(B, $BFC<l$J?t(B
\E
\BEG
@node Referencing results and special numbers,,, Risa/Asir
@section Referencing results and special numbers
\E
@noindent
\JP @code{@@} $B$O%(%9%1!<%WJ8;z$H$7$F;HMQ$5$l$k(B. $B8=:_<!$N$h$&$J5,Dj$,$"$k(B.
\BEG
An @code{@@} used for an escape character; rules currently in force
are as follows.
\E
@table @code
\BJP
@item @@@var{n}
@var{n} $BHVL\$N7W;;7k2L(B.
@item @@@@
$BD>A0$N7W;;7k2L(B.
@item @@i
$B5u?tC10L(B.
@item @@pi
$B1_<~N((B.
@item @@e
$B<+A3BP?t$NDl(B.
@item @@
2 $B85BN(B GF(2) $B>e$N0lJQ?tB?9`<0$NJQ?t(B ($BITDj85(B).
@item @@>, @@<, @@>=, @@<=, @@==, @@&&, @@||
quantifier elimination $B$K$*$1$k(B, $B0l3,=R8lO@M}1i;;;R(B
\E
\BEG
@item @@@var{n}
The evaluated result of @var{n}-th input command
@item @@@@
The evaluated result of the last command
@item @@i
The unit of imaginary number, square root of -1.
@item @@pi
The number pi,
the ratio of a circumference of the circle and its diameter.
@item @@e
Napier's number, the base of natural logarithm.
@item @@
A generator of GF(2^m), a finite field of characteristic 2, over GF(2).
It is a root of an irreducible univariate polynomial over GF(2)
which is set as the defining polynomial of GF(2^m).
@item @@>, @@<, @@>=, @@<=, @@==, @@&&, @@||
Fist order logical operators. They are used in quantifier elimination.
\E
@end table
@example
[0] fctr(x^10-1);
[[1,1],[x-1,1],[x+1,1],[x^4+x^3+x^2+x+1,1],[x^4-x^3+x^2-x+1,1]]
[1] @@@@[3];
[x^4+x^3+x^2+x+1,1]
[2] eval(sin(@@pi/2));
1.000000000000000000000000000000000000000000000000000000000
[3] eval(log(@@e),20);
0.99999999999999999999999999998
[4] @@0[4][0];
x^4-x^3+x^2-x+1
[5] (1+@@i)^5;
(-4-4*@@i)
[6] eval(exp(@@pi*@@i));
-1.0000000000000000000000000000
[7] (@@+1)^9;
(@@^9+@@^8+@@+1)
@end example
@noindent
\BJP
$B%H%C%W%l%Y%k$G7W;;$5$l$?CM$O$3$N$h$&$K%R%9%H%j$H$7$F<h$j=P$72DG=$G$"$k$,(B,
$B$3$N$3$H$O(B, $B%,%Y!<%8%3%l%/%?$K$H$C$F$OIiC4$r$b$?$i$92DG=@-$,$"$k(B. $BFC$K(B,
$BBg$-$J<0$r%H%C%W%l%Y%k$G7W;;$7$?>l9g(B, $B$=$N8e$N(B GC $B;~4V$,5^B.$KA}Bg$9$k2D(B
$BG=@-$,$"$k(B. $B$3$N$h$&$J>l9g(B, @code{delete_history()}
(@pxref{delete_history,,@code{delete_history}}) $B$,M-8z$G$"$k(B.
\E
\BEG
As you can see in the above example,
results of toplevel computation can be referred to
by @code{@@} convention.
This is convenient for users, while it sometimes imposes a heavy
burden to the garbage collector.
It may happen that GC time will rapidly increase after computing
a very large expression at the toplevel.
In such cases @code{delete_history()}
(@pxref{delete_history,,@code{delete_history}}) takes effect.
\E