[BACK]Return to math2ox.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_math / documents

Annotation of OpenXM/src/ox_math/documents/math2ox.texi, Revision 1.6

1.6     ! ohara       1: %% $OpenXM: OpenXM/src/ox_math/documents/math2ox.texi,v 1.5 2000/03/14 14:25:27 ohara Exp $
1.1       ohara       2:
                      3: \input texinfo
                      4: @iftex
                      5: @catcode`@#=6
                      6: @def@b#1{{@bf@gt #1}}
                      7: @catcode`@#=@other
                      8: @end iftex
                      9: @overfullrule=0pt
                     10: @c -*-texinfo-*-
                     11: @comment %**start of header
                     12: @setfilename Math2ox
                     13: @settitle Math2ox
                     14: @comment %**end of header
                     15: @comment %@setchapternewpage odd
                     16:
                     17: @iftex
                     18: @comment @finalout
                     19: @end iftex
                     20:
                     21: @titlepage
                     22:
                     23: @title Math2ox
                     24: @subtitle Math2ox User's Manual (English Edition)
                     25: @subtitle Edition 1.1.2 for OpenXM/oxmath
                     26: @subtitle March 2000
                     27:
                     28: @author  by Katsuyoshi Ohara
                     29: @end titlepage
                     30:
                     31: @synindex vr fn
                     32:
                     33: @comment  node-name,  next,  previous,  up
                     34: @node Top,, (dir), (dir)
                     35:
                     36: @menu
1.6     ! ohara      37: * Starting OX servers::
1.1       ohara      38: * Mathematica Client Functions::
                     39: * Sample Programs::
1.6     ! ohara      40: * Example::
        !            41: * References::
1.1       ohara      42: @end menu
                     43:
1.3       ohara      44: @node Starting OX servers,,, Top
1.6     ! ohara      45: @chapter Starting OX servers
        !            46:
        !            47: @node Loading an OX Client on Mathematica,,, Starting OX servers
        !            48: @section Loading an OX Client on Mathematica
        !            49:
        !            50: The program @code{math2ox} is an external module for Mathematica
        !            51: to call OpenXM servers.
        !            52: The @code{math2ox} communicates with OpenXM servers by the OpenXM protocol
        !            53: and communicates with Mathematica by MathLink.
1.3       ohara      54:
1.6     ! ohara      55: @example
        !            56: In[1]:= Install["math2ox"]
        !            57: @end example
        !            58:
        !            59: We recommend loading a mathematica program @code{oxclient.m} instead of
        !            60: calling @code{Install[]} directly:
        !            61: @example
        !            62: In[1] := <<oxclient.m
        !            63: @end example
1.3       ohara      64:
                     65: @node Starting OX servers on the localhost,,, Starting OX servers
                     66: @section Starting OX servers on the localhost
                     67:
                     68: @c  Description of OxStart
                     69: @menu
                     70: * OxStart::
                     71: @end menu
                     72: @node OxStart,,,
                     73: @subsection @code{OxStart}
                     74: @findex OxStart
                     75: @table @t
                     76: @item OxStart[@var{s}]
                     77: ::  Start the OX server @code{s}.
                     78: @end table
                     79:
                     80: @table @var
                     81: @item return
                     82: Integer
                     83: @item s
                     84: String
                     85: @end table
                     86:
                     87: @itemize @bullet
                     88: @item  It starts the OX server @code{s}.
1.4       ohara      89: @item Servers are looked for in the directory $OpenXM_HOME/bin, hoge hoge.
1.3       ohara      90: @end itemize
                     91:
                     92: @example
1.6     ! ohara      93: In[1]:= pid = OxStart["ox_sm1"]
1.3       ohara      94: @end example
                     95:
                     96: In this example, @code{ox_sm1} is started on the local machine.
                     97:
                     98: @node Starting OX servers on a remote machine,,, Top
                     99: @section Starting OX servers on a remote machine
                    100:
1.4       ohara     101: In order to connect to remote OX servers, it is convenient, secure and
                    102: recommended to use @code{ssh} (Secure SHell).
                    103: The function @code{OxStartRemoteSSH} starts remote OX servers
                    104: by ssh.  Of course, you are supposed to be able to login the remote
                    105: machine by @code{ssh} and @code{$Remote_OpenXM_HOME/rc/cshrc} or
                    106: @code{$Remote_OpenXM_HOME/rc/bashrc} are executed from the login shell
                    107: of your remote machine.
                    108: The function @code{OxStartRemoteSSH[]} does not request your password,
                    109: that is, you need to be using @code{ssh-agent} before calling
                    110: @code{OxStartRemoteSSH[]}.
                    111: Then there will be no check of password.
1.3       ohara     112:
                    113: @c  Description of OxStartRemoteSSH
                    114: @menu
                    115: * OxStartRemoteSSH::
                    116: @end menu
                    117: @node OxStartRemoteSSH,,,
                    118: @subsection @code{OxStartRemoteSSH}
                    119: @findex OxStartRemoteSSH
                    120: @table @t
                    121: @item OxStartRemoteSSH[@var{s}, @var{host}]
1.4       ohara     122: ::  start the OX server @code{s} on the remote machine @code{host} by ssh.
1.3       ohara     123: @end table
                    124:
                    125: @table @var
                    126: @item return
                    127: Integer
                    128: @item s
                    129: String
                    130: @item host
                    131: String
                    132: @end table
                    133:
1.4       ohara     134: We note that the @code{OxStartRemoteSSH[]} is an experimental implementation.
1.3       ohara     135:
                    136: @itemize @bullet
                    137: @item  It starts the OX server @code{s}.
1.4       ohara     138: @item Servers are looked for in the directory $OpenXM_HOME/bin, hoge hoge.
1.3       ohara     139: @end itemize
                    140:
                    141: @example
1.6     ! ohara     142: In[1]:= pid = OxStartRemoteSSH["ox_sm1", "remotehost"]
1.3       ohara     143: @end example
                    144:
                    145: In this example, @code{ox_sm1} is started on the remote machine @code{remotehost}.
                    146:
1.1       ohara     147: @node Mathematica Client Functions,,, Top
                    148: @chapter Mathematica Client Functions
                    149:
                    150: @c  Description of OxStart
                    151: @menu
                    152: * OxStart::
                    153: @end menu
                    154: @node OxStart,,, Mathematica Client Functions
                    155: @section @code{OxStart}
                    156: @findex OxStart
                    157: @table @t
1.2       ohara     158: @item OxStart[@var{s}]
1.1       ohara     159: ::  Start the OX server @code{s}.
                    160: @end table
                    161:
                    162: @table @var
                    163: @item return
                    164: Integer
                    165: @item s
                    166: String
                    167: @end table
                    168:
                    169: @itemize @bullet
                    170: @item  It starts the OX server @code{s}.
1.4       ohara     171: @item Servers are looked for in the directory $OpenXM_HOME/bin, hoge hoge.
1.1       ohara     172: @end itemize
                    173:
                    174: @example
1.6     ! ohara     175: In[1]:= pid = OxStart["ox_sm1"]
1.1       ohara     176: @end example
                    177:
                    178: In this example, @code{ox_sm1} is started on the local machine.
                    179:
1.2       ohara     180: @c  Description of OxSendMessage
                    181: @menu
                    182: * OxSendMessage::
                    183: @end menu
                    184: @node OxSendMessage,,, Mathematica Client Functions
                    185: @section @code{OxSendMessage}
                    186: @findex OxSendMessage
                    187: @table @t
                    188: @item OxSendMessage[@var{pid}, @var{s}]
1.3       ohara     189: ::  send a message @code{s} to the OX server @code{pid}.
1.2       ohara     190: @end table
                    191:
                    192: @table @var
                    193: @item return
                    194: Integer
1.3       ohara     195: @item pid
1.2       ohara     196: Integer
                    197: @item s
                    198: String
                    199: @end table
                    200:
                    201: @example
                    202: In[4] := OxSendMessage[pid, "(CMO_LIST, (CMO_STRING, "hello world"), (CMO_ZERO))"]
                    203: In[5] := OxSendMessage[pid, "(OX_COMMAND, (SM_popCMO))"]
                    204: @end example
                    205:
                    206: In this example, an OX data message
                    207: (OX_DATA, (CMO_LIST, (CMO_STRING, "hello world"), (CMO_ZERO))
                    208: and an OX command message (OX_COMMAND, (SM_popCMO)) are sent to
                    209: the OX server @code{pid}.
                    210:
1.3       ohara     211: @c  Description of OxPopCMO
                    212: @menu
                    213: * OxPopCMO::
                    214: @end menu
                    215: @node OxPopCMO,,, Mathematica Client Functions
                    216: @section @code{OxPopCMO}
                    217: @findex OxPopCMO
                    218: @table @t
                    219: @item OxPopCMO[@var{pid}]
                    220: ::  pop an object on the top of the stack.
                    221: @end table
                    222:
                    223: @table @var
                    224: @item return
                    225: Manual
                    226: @item pid
                    227: Integer
                    228: @end table
                    229:
1.4       ohara     230: The @code{OxPopCMO[]} function pops an object on the top of the stack of
1.3       ohara     231: the OX stack machine @code{pid} and returns the object.
1.4       ohara     232: The return type of the function @code{OxPopCMO[]} is @code{Manual} in
                    233: terms of MathLink, that is, an object of suitable type is returned.
1.3       ohara     234:
                    235: @example
1.4       ohara     236: In[5] := cmo = OxPopCMO[pid]
1.3       ohara     237: @end example
                    238:
                    239: @c  Description of OxPopString
                    240: @menu
                    241: * OxPopString::
                    242: @end menu
                    243: @node OxPopString,,, Mathematica Client Functions
                    244: @section @code{OxPopString}
                    245: @findex OxPopString
                    246: @table @t
                    247: @item OxPopString[@var{pid}]
                    248: ::  get a string from the OX server @code{pid}.
                    249: @end table
                    250:
                    251: @table @var
                    252: @item return
                    253: String
                    254: @item pid
                    255: Integer
                    256: @end table
                    257:
1.4       ohara     258: The @code{OxPopString[]} function pops an object on the top of the stack
1.3       ohara     259: of the OX stack machine @code{pid} and returns a string which is
1.4       ohara     260: translated from the object by the OX stack machine.
1.3       ohara     261:
                    262: @example
1.4       ohara     263: In[5] := string = OxPopString[pid]
1.3       ohara     264: @end example
                    265:
                    266: @c  Description of OxClose
                    267: @menu
                    268: * OxClose::
                    269: @end menu
                    270: @node OxClose,,, Mathematica Client Functions
                    271: @section @code{OxClose}
                    272: @findex OxClose
                    273: @table @t
                    274: @item OxClose[@var{pid}]
                    275: ::  close the connection to the OX server @code{pid}.
                    276: @end table
                    277:
                    278: @table @var
                    279: @item return
                    280: none
                    281: @item pid
                    282: Integer
                    283: @end table
                    284:
1.4       ohara     285: The @code{OxClose[]} function closes the connection to the OX server
1.3       ohara     286: @code{pid}.
                    287:
                    288: @example
1.4       ohara     289: In[5] := OxClose[pid]
1.3       ohara     290: @end example
                    291:
                    292: @c  Description of OxExecuteString
                    293: @menu
                    294: * OxExecuteString::
                    295: @end menu
                    296: @node OxExecuteString,,, Mathematica Client Functions
                    297: @section @code{OxExecuteString}
                    298: @findex OxExecuteString
                    299: @table @t
                    300: @item OxExecuteString[@var{pid}, @var{command}]
                    301: ::  execute @code{command} on the OX server @code{pid}.
                    302: @end table
                    303:
                    304: @table @var
                    305: @item return
                    306: none
                    307: @item pid
                    308: Integer
                    309: @item command
                    310: String
                    311: @end table
                    312:
                    313: The @code{OxExecuteString[]} function executes @code{command} on the OX server
                    314: @code{pid}.
1.4       ohara     315: The string @code{command} is interpreted in local language of the OX server.
1.3       ohara     316:
                    317: @example
                    318: In[5] := OxExecuteString["print(1+2);"]
                    319: @end example
                    320:
                    321: @c  Description of OxGet
                    322: @menu
                    323: * OxGet::
                    324: @end menu
                    325: @node OxGet,,, Mathematica Client Functions
                    326: @section @code{OxGet}
                    327: @findex OxGet
                    328: @table @t
                    329: @item OxGet[@var{pid}]
                    330: ::  get an object from the connection to the OX server @code{pid}.
                    331: @end table
                    332:
                    333: @table @var
                    334: @item return
                    335: Manual
                    336: @item pid
                    337: Integer
                    338: @end table
                    339:
1.4       ohara     340: The @code{OxGet[]} function gets an object from the connection to the OX server
1.3       ohara     341: @code{pid}.
1.1       ohara     342:
1.3       ohara     343: @example
1.4       ohara     344: In[5] := cmo = OxGet[pid]
1.3       ohara     345: @end example
1.2       ohara     346:
1.3       ohara     347: @c  Put descriptions of a next function.
1.1       ohara     348:
                    349: @node Sample Programs,,, Top
                    350: @chapter Sample Programs
                    351:
1.5       ohara     352: @enumerate
                    353: @item
                    354: @code{OpenXM/lib/math/primadec.m} is a Mathematica program
1.1       ohara     355: to make primary ideal decompositions by calling
1.5       ohara     356: @code{ox_asir}.
1.1       ohara     357: As to usages, see comments in this file.
                    358:
1.5       ohara     359: @item
                    360: @code{OpenXM/lib/math/beta.m} is a Mathematica program
                    361: to get beta-nbc bases by calling @code{ox_asir}.
                    362: @end enumerate
                    363:
                    364: @node Example,,, Top
                    365: @chapter Example
                    366:
                    367: The @code{math2ox} has the following commands:
                    368:
                    369: @code{OxStart[s_String],
                    370: OxStartInsecure[s_String, p_Integer, q_Integer],
                    371: OxStartRemoteSSH[s_String, t_String],
                    372: OxExecuteString[s_String], OxSendMessage[s_String], OxGet[], OxPopCMO[],
                    373: OxPopString[], OxClose[], OxReset[]}.
1.1       ohara     374:
1.5       ohara     375: First, let us load the math2ox.
                    376: @example
                    377: In[1]:= <<oxclient.m
                    378: @end example
                    379:
                    380: Second, let us open a connection with an OX server.
                    381: For example, if we want to call the @code{ox_sm1} (the kan/sm1 server), then
                    382: @example
                    383: In[2] := pid = OxStart[pid, "ox_sm1"]
                    384: @end example
                    385: where we have the connection of reverse mode.  The OxStart function
                    386: automatically invoke @code{ox_sm1} on the local machine.  If you need to
                    387: connect an OX server on a remote machine, then you can use reverse mode.
                    388: @example
                    389: In[2] := pid = OxStartInsecure["water.s.kanazawa-u.ac.jp", 1300, 1400]
                    390: @end example
                    391: The mode is not secured but you can crypt data stream by using ssh
                    392: (Secure SHell).
                    393: @example
                    394: In[3] := Run["ssh -f water ox -insecure -ox ox_sm1 -host water"]
                    395: @end example
                    396:
                    397: Third, let us send an OX message to the OX server.
                    398: We can send an OX message written in OX/CMO expressions.
                    399: @example
                    400: In[4] := OxSendMessage[pid, "(CMO_LIST, (CMO_STRING, "hello world"), (CMO_ZERO))"]
                    401: In[5] := OxSendMessage[pid, "(OX_COMMAND, (SM_popCMO))"]
                    402: @end example
1.6     ! ohara     403: If the expression contains syntax errors, then nothing is sent.
1.5       ohara     404:
                    405: Remarks: if @code{SM_popCMO} is sent by the @code{OxSendMessage[]} function, then the
                    406: OX stack machine returns the top of the stack to the @code{math2ox}.
                    407: Then, in order to receive the message, we need to call the @code{OxGet[]}
                    408: function always after executing @code{OxSendMessage[]}
                    409: @example
                    410: In[6] := OxGet[pid]
                    411: @end example
                    412:
                    413: If we do not use the @code{OxSendMessage} function and use the @code{OxPopCMO[]}
                    414: function, then we do not need to call the @code{OxGet[]}.
                    415: @example
                    416: In[5] := OxPopCMO[pid]
                    417: @end example
                    418:
                    419: Fourth, if we send a command expressed in the local language of the OX
                    420: server, then we need to call the @code{OxExecuteString[]} function.
                    421:
                    422: Last, let us close the connection.
                    423: @example
                    424: In[7] := OxClose[pid]
                    425: @end example
1.1       ohara     426:
1.5       ohara     427: @c @node Bibliography,,, Top
                    428: @c @unnumbered Bibliography
                    429: @node References,,, Top
                    430: @unnumbered References
                    431:
                    432: @enumerate
                    433: @item
                    434: M. Noro, N. Takayama:
                    435: Design and Implementation of OpenXM, 1996, 1997, 1998, 1999, 2000.
                    436:
                    437: @item
                    438: @code{http://www.math.kobe-u.ac.jp/OpenXM/}
                    439:
                    440: @item
                    441: M. Noro, K. Ohara, N. Takayama:
                    442: {Introduction to Open Asir}, 1999, Suusiki Shori, Vol 7, No 2,
                    443: 2--17. (ISBN4-87243-086-7, SEG Publishing, Tokyo). (in Japanese)
                    444:
                    445: @item
                    446: Stephen Wolfram:
                    447: {The Mathematica Book}, Third edition,
                    448: Wolfram Media/Cambridge University Press, 1996.
                    449:
                    450: @item
                    451: T. Miyachi:
                    452: {Mathematica Network Programming},
                    453: Iwanami Shoten Publishers, 1998. (in Japanese)
                    454: @end enumerate
1.1       ohara     455:
                    456: @node Index,,, Top
                    457: @unnumbered Index
                    458: @printindex fn
                    459: @printindex cp
                    460: @iftex
                    461: @vfill @eject
                    462: @end iftex
                    463: @summarycontents
                    464: @contents
                    465: @bye
                    466:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>