version 1.4, 2000/03/14 05:46:09 |
version 1.8, 2000/03/15 10:52:20 |
|
|
%% $OpenXM: OpenXM/src/ox_math/documents/math2ox.texi,v 1.3 2000/03/14 02:21:40 ohara Exp $ |
%% $OpenXM: OpenXM/src/ox_math/documents/math2ox.texi,v 1.7 2000/03/15 08:22:20 ohara Exp $ |
|
|
\input texinfo |
\input texinfo |
@iftex |
@iftex |
|
|
@node Top,, (dir), (dir) |
@node Top,, (dir), (dir) |
|
|
@menu |
@menu |
|
* Starting OX servers:: |
* Mathematica Client Functions:: |
* Mathematica Client Functions:: |
* Sample Programs:: |
* Sample Programs:: |
|
* Example:: |
|
* References:: |
@end menu |
@end menu |
|
|
@node Starting OX servers,,, Top |
@node Starting OX servers,,, Top |
|
|
@chapter Starting OX servers |
@chapter Starting OX servers |
|
|
|
@node Loading an OX Client on Mathematica,,, Starting OX servers |
|
@section Loading an OX Client on Mathematica |
|
|
|
The program @code{math2ox} is an external module for Mathematica |
|
to call OpenXM servers. |
|
The @code{math2ox} communicates with OpenXM servers by the OpenXM protocol |
|
and communicates with Mathematica by MathLink. |
|
|
|
In order to execute @code{math2ox}, you need to type as follows: |
|
@example |
|
In[1]:= Install["math2ox"] |
|
@end example |
|
|
|
The Mathematica program oxclient.m, which is used to load math2ox |
|
and set some global variables, is in the directory |
|
@code{$OpenXM_HOME/lib/oxmath}. |
|
The standard value of @code{$OpenXM_HOME} is @code{/usr/local/OpenXM}. |
|
We recommend using @code{oxclient.m} instead of @code{Install[]}: |
|
@example |
|
In[1] := <<oxclient.m |
|
@end example |
|
|
@node Starting OX servers on the localhost,,, Starting OX servers |
@node Starting OX servers on the localhost,,, Starting OX servers |
@section Starting OX servers on the localhost |
@section Starting OX servers on the localhost |
|
|
|
|
@end itemize |
@end itemize |
|
|
@example |
@example |
In[1]:= Install["math2ox"] |
In[1]:= pid = OxStart["ox_sm1"] |
In[2]:= pid = OxStart["ox_sm1"] |
|
@end example |
@end example |
|
|
In this example, @code{ox_sm1} is started on the local machine. |
In this example, @code{ox_sm1} is started on the local machine. |
|
|
|
|
|
|
|
|
@node Starting OX servers on a remote machine,,, Top |
@node Starting OX servers on a remote machine,,, Top |
@section Starting OX servers on a remote machine |
@section Starting OX servers on a remote machine |
|
|
Line 89 by ssh. Of course, you are supposed to be able to log |
|
Line 109 by ssh. Of course, you are supposed to be able to log |
|
machine by @code{ssh} and @code{$Remote_OpenXM_HOME/rc/cshrc} or |
machine by @code{ssh} and @code{$Remote_OpenXM_HOME/rc/cshrc} or |
@code{$Remote_OpenXM_HOME/rc/bashrc} are executed from the login shell |
@code{$Remote_OpenXM_HOME/rc/bashrc} are executed from the login shell |
of your remote machine. |
of your remote machine. |
The function @code{OxStartRemoteSSH[]} does not request your password, |
The function @code{OxStartRemoteSSH[]} does not ask your password, |
that is, you need to be using @code{ssh-agent} before calling |
that is, you need to be using @code{ssh-agent} before calling |
@code{OxStartRemoteSSH[]}. |
@code{OxStartRemoteSSH[]}. |
Then there will be no check of password. |
Then there will be no check of password. |
|
|
|
@node Starting the X Window System with ssh-agent,,, Starting OX servers on a remote machine |
|
@subsection Starting the X Window System with ssh-agent |
|
|
|
In this subsection, we will explain how to start ssh-agent |
|
and set your password by ssh-add |
|
for reader's convinience. As to details, see ssh-agent (1) |
|
and ssh-add (1). |
|
If you start the X-windows system by @code{startx}, you can start |
|
ssh-agent by @code{ssh-agent startx}. |
|
|
|
@example |
|
bash$ ssh-agent startx |
|
@end example |
|
If you use @code{xdm} program to login your machine, |
|
then your @code{.xsession} script needs to contain the followings: |
|
@example |
|
exec ssh-agent .xinitrc |
|
@end example |
|
@noindent |
|
where @code{.xinitrc} is executable. |
|
|
|
After starting the X Window System, you need to type on suitable terminal |
|
emulator as follows: |
|
@example |
|
bash$ ssh-add |
|
@end example |
|
@noindent |
|
and input your passphrase. Once you set your passphrase by ssh-add, you |
|
no longer need to input your passphrase to access to other machines by |
|
ssh. |
|
|
@c Description of OxStartRemoteSSH |
@c Description of OxStartRemoteSSH |
@menu |
@menu |
* OxStartRemoteSSH:: |
* OxStartRemoteSSH:: |
Line 123 We note that the @code{OxStartRemoteSSH[]} is an exper |
|
Line 174 We note that the @code{OxStartRemoteSSH[]} is an exper |
|
@end itemize |
@end itemize |
|
|
@example |
@example |
In[2]:= pid = OxStartRemoteSSH["ox_sm1", "remotehost"] |
In[1]:= pid = OxStartRemoteSSH["ox_sm1", "remotehost"] |
@end example |
@end example |
|
|
In this example, @code{ox_sm1} is started on the remote machine @code{remotehost}. |
In this example, @code{ox_sm1} is started on the remote machine @code{remotehost}. |
|
|
@node Mathematica Client Functions,,, Top |
@node Mathematica Client Functions,,, Top |
|
|
@chapter Mathematica Client Functions |
@chapter Mathematica Client Functions |
|
|
The program @code{math2ox} is an external module for Mathematica |
|
to call OpenXM servers. |
|
The @code{math2ox} communicates with OpenXM servers by the OpenXM protocol |
|
and communicates with Mathematica by MathLink. |
|
|
|
@c Description of OxStart |
@c Description of OxStart |
@menu |
@menu |
* OxStart:: |
* OxStart:: |
|
|
@end itemize |
@end itemize |
|
|
@example |
@example |
In[1]:= Install["math2ox"] |
In[1]:= pid = OxStart["ox_sm1"] |
In[2]:= pid = OxStart["ox_sm1"] |
|
@end example |
@end example |
|
|
In this example, @code{ox_sm1} is started on the local machine. |
In this example, @code{ox_sm1} is started on the local machine. |
Line 340 In[5] := cmo = OxGet[pid] |
|
Line 384 In[5] := cmo = OxGet[pid] |
|
@node Sample Programs,,, Top |
@node Sample Programs,,, Top |
@chapter Sample Programs |
@chapter Sample Programs |
|
|
@tex |
@enumerate |
\noindent |
@item |
1. |
@code{OpenXM/lib/math/oxclient.m} is a Mathematica program |
{\tt OpenXM/lib/math/primadec.m} is a Mathematica program |
to load the @code{math2ox} and to define some Mathematica |
|
functions for @code{primadec.m} and @code{beta.m}. |
|
|
|
@item |
|
@code{OpenXM/lib/math/primadec.m} is a Mathematica program |
to make primary ideal decompositions by calling |
to make primary ideal decompositions by calling |
{\tt ox\_asir}. |
@code{ox_asir}. |
As to usages, see comments in this file. |
As to usages, see comments in this file. |
|
|
\noindent 2. |
@item |
{\tt OpenXM/lib/math/beta.m} is a Mathematica program |
@code{OpenXM/lib/math/beta.m} is a Mathematica program |
to get beta-nbc bases by calling {\tt ox\_asir}. |
to get beta-nbc bases by calling @code{ox_asir}. |
@end tex |
@end enumerate |
|
|
|
@node Example,,, Top |
|
@chapter Example |
|
|
|
In this section, we will present a simple OpenXM session |
|
on Mathematica to send a list |
|
@example |
|
["Hello World", 0] |
|
@end example |
|
@noindent |
|
to a server and pops that list from the server. |
|
|
|
The @code{math2ox} has the following commands: |
|
|
|
@code{OxStart[], |
|
OxStartInsecure[], |
|
OxStartRemoteSSH[], |
|
OxExecuteString[], |
|
OxSendMessage[], |
|
OxGet[], |
|
OxPopCMO[], |
|
OxPopString[], |
|
OxClose[], |
|
OxReset[]}. |
|
|
|
First, let us load the @code{math2ox}. |
|
@example |
|
In[1]:= <<oxclient.m |
|
@end example |
|
|
|
Second, let us open a connection with an OX server. |
|
For example, if we want to call the @code{ox_sm1} (the kan/sm1 server), then |
|
@example |
|
In[2] := pid = OxStart["ox_sm1"] |
|
@end example |
|
@noindent |
|
where we have the connection of reverse mode. The @code{OxStart} |
|
function automatically invoke @code{ox_sm1} on the localhost. |
|
If you need to connect remote OX servers, then you can use reverse mode. |
|
@example |
|
In[2] := pid = OxStartRemoteSSH["ox_sm1", "orange.math.kobe-u.ac.jp"] |
|
@end example |
|
|
|
@c Remarks: old version. |
|
@c @example |
|
@c In[2] := pid = OxStartInsecure["water.s.kanazawa-u.ac.jp", 1300, 1400] |
|
@c @end example |
|
@c The mode is not secured but you can crypt data stream by using ssh |
|
@c (Secure SHell). |
|
@c @example |
|
@c In[3] := Run["ssh -f water ox -insecure -ox ox_sm1 -host water"] |
|
@c @end example |
|
|
|
Third, let us send an OX message to the OX server. |
|
We can send an OX message written in OX/CMO expressions. |
|
@example |
|
In[4] := OxSendMessage[pid, "(CMO_LIST, (CMO_STRING, "hello world"), (CMO_ZERO))"] |
|
@end example |
|
@noindent |
|
If the expression contains syntax errors, then nothing is sent. |
|
|
|
If you need to get the object on the top of the stack of an OX server |
|
@code{pid}, then you can call the following function: |
|
@example |
|
In[5] := cmo = OxPopCMO[pid] |
|
@end example |
|
|
|
The function @code{OxPopCMO} above is equivalent to |
|
the following two command: |
|
@example |
|
In[5] := OxSendMessage[pid, "(OX_COMMAND, (SM_popCMO))"] |
|
In[6] := cmo = OxGet[pid] |
|
@end example |
|
|
|
Remarks: |
|
if @code{SM_popCMO} is sent by the @code{OxSendMessage[]} function, then |
|
the OX stack machine returns the top of the stack to the @code{math2ox}. |
|
Then, in order to receive the message, we need to call the |
|
@code{OxGet[]} function always after executing @code{OxSendMessage[]}. |
|
That is @code{OxGet} flushes the communication route to @code{pid}. If |
|
we never use the @code{OxSendMessage} function, then we do not need to |
|
call the @code{OxGet[]}. |
|
|
|
Fourth, if we send a command expressed in the local language of the OX |
|
server, then we need to call the @code{OxExecuteString[]} function. |
|
|
|
Last, let us close the connection. |
|
@example |
|
In[7] := OxClose[pid] |
|
@end example |
|
|
|
@c @node Bibliography,,, Top |
|
@c @unnumbered Bibliography |
|
@node References,,, Top |
|
@unnumbered References |
|
|
|
@enumerate |
|
@item |
|
M. Noro, N. Takayama: |
|
Design and Implementation of OpenXM, 1996, 1997, 1998, 1999, 2000. |
|
|
|
@item |
|
@code{http://www.math.kobe-u.ac.jp/OpenXM/} |
|
|
|
@item |
|
M. Noro, K. Ohara, N. Takayama: |
|
{Introduction to Open Asir}, 1999, Suusiki Shori, Vol 7, No 2, |
|
2--17. (ISBN4-87243-086-7, SEG Publishing, Tokyo). (in Japanese) |
|
|
|
@item |
|
Stephen Wolfram: |
|
{The Mathematica Book}, Third edition, |
|
Wolfram Media/Cambridge University Press, 1996. |
|
|
|
@item |
|
T. Miyachi: |
|
{Mathematica Network Programming}, |
|
Iwanami Shoten Publishers, 1998. (in Japanese) |
|
@end enumerate |
|
|
@node Index,,, Top |
@node Index,,, Top |
@unnumbered Index |
@unnumbered Index |