RFC 578

Using MIT-Mathlab MACSYMA from MIT-DMS Muddle

πŸ“… published October 1973, from ietf

RFC 578: Using MIT-MATHLAB MACSYMA from MIT-DMS MUDDLE ✨

An Experiment in Automated Resource Sharing πŸŽ€

Title block tea: this is Request for Comments 578 from the Network Working Group 🧚, written by A. Bhushan and N. Ryan of MIT-PTD (DMS), with the NIC number 19501 and a date of October 1973 πŸ¦‹. The title block I was given doesn't list a category, an obsoletes entry, or an updates entry, so there's nothing more to add up here πŸ’….


I. INTRODUCTION ✨

Okay so this paper is about an experiment in non-trivial automated resource sharing between dissimilar systems πŸ’–. The goal was to hook up the MUDDLE system at MIT-DMS (Host 70.) to the MACSYMA system at MIT-Mathlab (Host 198.) πŸ”₯. The best part? The MUDDLE-user at MIT-DMS doesn't need to know anything about the ARPANET, Mathlab, or even MACSYMA πŸ™ˆ. They don't even have to realise part of the computation is happening on the Mathlab computer. Iconic πŸ’….

This experiment is different from the MATHLAB-UCSB/OLS experiment (ref. NWG/RFC 525, NIC 17161 "MIT-MATHLAB Meets UCSB-OLS" by Parrish and Pickens) in a few important ways 🌸. First, the remote network resource is completely automated ✨. The human user just calls a MUDDLE function like "INTEGRATE" that needs the remote MACSYMA resource to do the work. The program handles everything: connecting to Mathlab, logging in, and using MACSYMA 😭. (In the UCSB-OLS experiment, the user had to do all of that by hand. They connected to Mathlab, logged in, used MACSYMA, typed the input in a form MACSYMA would take, saved the results in a file at Mathlab, disconnected, started a retrieval job at UCSB to grab the "saved" results, and finally sent those results to a local program. Exhausting, honestly πŸ’€.)

Second, the remote resource is completely integrated into the local MUDDLE system πŸ¦‹. The user can write computations in a form MUDDLE understands. The resource-sharing program (which the user doesn't even need to know exists) translates from MUDDLE "prefix" form to MACSYMA "infix" form on the way in, and back again on the way out 🧚. This is what lets the MACSYMA resources blend right into MUDDLE, so parts of the same computation can run on MACSYMA and other parts on MUDDLE. Main character energy πŸ‘‘.

II. THE MACSYMA AND MUDDLE RESOURCES 🌈

Before we get into the resource-sharing facility, we need to talk about the two resources, MACSYMA and MUDDLE πŸ“š. The MACSYMA system at Mathlab is a powerful tool for symbolic manipulation of algebraic functions πŸ”₯. Among other things, it can do symbolic integration and differentiation, expand series, do Laplace and inverse-Laplace transforms, solve equations and systems of equations, and simplify rational functions ✨. (You can read about MACSYMA's capabilities in "The MACSYMA Users' Manual", available from the MIT-Mathlab group at Project MAC πŸŽ€.)

The MUDDLE system is a general-purpose environment that's good for automatic programming, graphics, data management, "networking", and mathematical computations πŸ’œ. The MUDDLE language is a big upgrade on the list processing language LISP when it comes to data types like strings, vectors, uniform vectors, and user-definable types 🌸. (MUDDLE is covered in detail in "The MUDDLE Primer" (SYS.11.01) by Greg Pfister, available from the Programming Technology Division at Project MAC πŸ¦‹.)

MUDDLE has seriously extensive graphical and numerical computation facilities 😭. Users can display graphs on ARDS and IMLAC type consoles, and on the Evans and Sutherland (E&S) display system ✨. MUDDLE console graphics let you view graphical representations of functions, with overlay capability and automatic scaling that you can control yourself πŸ“. The E&S gives you a versatile tool for studying the dynamic characteristics of graphs, curved surfaces, and other three-dimensional objects 🧚. Put MACSYMA, MUDDLE, and the E&S graphics together and you get a very powerful problem-solving resource that's integrated and easy to use, thanks to the resource-sharing facility πŸ‘‘.

III. THE AUTOMATED RESOURCE-SHARING FACILITY πŸ’…

The resource-sharing facility in this paper uses the easiest communication path to MACSYMA available, which is the TELNET connection to the logger service on socket 1 πŸ¦‹. Nothing was changed in MACSYMA, and no special programs were made on the Mathlab computer πŸ™ˆ. All the resource-sharing work is done by programs in MUDDLE πŸ’–.

Let's be real from the start: we are not recommending this way of doing automated resource sharing 🫢. A resource-sharing protocol that lets programs use remote resources conveniently is far more reliable and efficient, but it requires work on the part of server sites 😭. The existing protocols and systems, FTP, RJE, RSEXEC, and the Datacomputer, mostly serve a small subset of easily managed resources πŸ’€. We're registering our wish for uniformity (which, sadly, is lacking) in the current systems, and we're working toward general-purpose resource sharing 🌈. Without a general resource-sharing protocol and a MACSYMA server to match at Mathlab, the TELNET connection is the best a user can do right now πŸ“.

The resource-sharing facility is made of several independent but integrated parts. They are:

  1. Connecting to Mathlab, login, and invoking MACSYMA.
  2. Conversion of MUDDLE's prefix to MACSYMA's infix form.
  3. Generation of MACSYMA input.
  4. Interpreting MACSYMA's results including errors and comments.
  5. MACSYMA infix to MUDDLE prefix conversion.
  6. Plotting graphs for the functions.
  7. Allowing human intervention if desired.
  8. Disconnect from MACSYMA.

Say you've loaded the necessary programs in MUDDLE. To integrate the function "3*X", the user just types:

<INTEGRATE '<* .X 3>>$

Here $ stands for the ASCII character <ESC> (or <ALT-MODE>) ✨. MUDDLE then returns this:

</ <* 3 <^ .X 2>> 2>

Or, if you'd rather use the infix form, you type:

<INTEGRATE "3*X">$

and MUDDLE gives back:

"3*X^2/2"

Here's what happens behind the scenes when INTEGRATE (or any other function that uses MACSYMA) gets called 🧚. If the user isn't already talking to a MACSYMA (the program keeps track of the connection), a connection gets set up to MIT-Mathlab πŸ”₯. The user is logged in automatically by the program, using the user's identification, and a MACSYMA is started πŸ’–. Then a prefix-to-infix conversion happens, and using the example above, this input is sent to MACSYMA:

STRING (INTEGRATE (3*X,X));

The program reads MACSYMA's output, spots error responses and comments, and pulls out the result if no error happened 🌸. That result is in infix form, so it gets converted to the prefix form that the MUDDLE INTEGRATE function returns πŸ¦‹.

The INTEGRATE function takes an optional argument: the variable you want to integrate with respect to ✨. The syntax is:

<INTEGRATE {EXPR} ["{VAR}"]>

Here EXPR is any expression of type STRING or QUOTED FORM πŸ’…. The optional VAR (the thing in square brackets) has to be of type STRING, enclosed in double quotes πŸŽ€. Other functions look like this:

<SIMPLIFY {EXPR}>
<DIFF {EXPR} ["{VAR}" "{TIMES}"]>
<EXPAND {EXPR} ["{MAXPOSEX}" "{MAXNEGEX}"]>

In those, TIMES is how many times EXPR gets differentiated, and MAXPOSEX and MAXNEGEX control the maximum positive and negative integer exponents used in expansion 🌈. The default for VAR is "X", the default for TIMES is "1", and the defaults for MAXPOSEX and MAXNEGEX are both "6" πŸ“.

The user can use the result from MUDDLE in any of their computations, including drawing a graph ⭐. For example, typing this:

<GRAPH <DIFF '<^ X. 3>> X -5 5>$

to MUDDLE will draw the graph "Y = 3*X^2" on the IMLAC or ARDS screen, with X going from -5 to +5 (assuming the user has the graphics package and the right IMLAC program loaded) πŸ“ˆ. You'd get the same graph by typing:

<GRAPH <IPARSE <DIFF "X^3">> X -5 5>$

IPARSE is the MUDDLE function that converts infix to prefix form 🫢. The matching function for prefix-to-infix conversion is UNIPARSE πŸ’œ.

If you want the nitty-gritty on using the MACSYMA resource-sharing facility, check the annotated script of the example in Section V of this paper πŸ”₯. Part 2 is coming, so stay tuned, bestie πŸ¦‹βœ¨

IV. CAPABILITIES AND LIMITATIONS ✨

okay so the program is lowkey trying its hardest to help you 🫢 like if the MIT-Mathlab computer isn't available, it just goes and grabs the MACSYMA service on the MIT-AI computer instead. that's backup-plan energy πŸ’–

it's pretty capable at fetching results, recognizing error messages, and separating comments, but it is NOT fool-proof 😭 it only makes an educated guess about where the answer is. a human sitting at a console could filter out stuff like "System going down" or a console-link message that pops up in the middle of a result, but the program can't always do that. this is one of the pitfalls of using a facility through a program that was basically built for human users πŸ’€

the reliability can be marginally improved by asking MACSYMA to print special characters before and after the results it sends (again, not fool-proof πŸ™ˆ). for example, this input to MACSYMA:

Block ([ans],
print (/(),
ans: diff (X^2,X),
print (string (ans))
print (/)),
return (ans));

will cause MACSYMA to generate this output:

(
2*X
)
(D**)           2X

from that output, the answer "2*X" can be easily extracted πŸŽ€

the resource sharing program does however recognize the so-called "unintegratable" functions such as "EXP (X^2)" and gives the correct error response πŸ’… normally you're in "TERSE" mode, so you don't see the interaction between MACSYMA and MUDDLE. to see it, you have to enter "VERBOSE" mode by typing:

<VERBOSE>$

to MUDDLE. to go back to "TERSE" mode you type:

<TERSE>$

if you're proficient with MACSYMA, you can also talk to it directly at any point by typing:

<TELCOM 1>$

to MUDDLE. TELCOM is super useful if you want to see what's going on, or if you wanna poke at the MACSYMA computations by entering the LISP environment (typing <Control-G> to MACSYMA). to get back to MUDDLE and the automated environment, you first escape to MUDDLE by typing <Control-E>, and then type:

<AUTO>$

to MUDDLE. if you type "<ERRET 1>$" after escaping to MUDDLE from "TELCOM" mode, you'll be put back in direct communication with MACSYMA. if your "MACSYMA" is hopelessly confused, or you want to start a brand new version of MACSYMA, you type:

<DIS>$

to MUDDLE, which disconnects you πŸ₯² typing "<MACSYMA>$", or using any of the functions that use MACSYMA, will connect you to MACSYMA again.

right now MUDDLE recognizes and takes action as described above whenever the differentiate, integrate, expand, simplify, and integrate.simplify (integrate and simplify) functions show up. but it's quite easy to generate programs for other operations, like Laplace transforms and solving equations 🧚 the prefix-to-infix conversion and vice-versa works for every mathematical form we've run into so far in our short experiment.

an alternate way to use MACSYMA's capabilities would have been to use it in the LISP environment, by building a suitable interface between LISP and MUDDLE. that would avoid the multiple conversions from prefix to infix form and back, but other, perhaps more difficult, conversions would be required πŸ€”

V. EXAMPLE πŸ¦‹

the following scenario shows you how to use the resource-sharing facility. the facility is accessible in the MUDDLE system at MIT-DMS. the interaction between MUDDLE and MACSYMA, which the user normally can't see, is shown here too (in VERBOSE mode) so the reader can get a better sense of how the program works πŸ‘€ the graphs only get plotted if the user has loaded the "graphics package" and is on an IMLAC or ARDS console. we also want to stress that this scenario is NOT meant to show off the full capabilities of MACSYMA or MUDDLE, it's only here to illustrate the resource sharing facility πŸ’œ

SCENARIO FOR USING THE MUDDLE-MACSYMA FACILITY

in this scenario, user input is underlined and our comments start with a semicolon. <CR> means carriage return and $ means <ESC> or alt-mode. the user is assumed to be logged in at MIT-DMS (Host 70). the input has to be typed exactly as shown, because MUDDLE cares about upper and lower case characters πŸ™ for a description of the MUDDLE system, check out "THE MUDDLE PRIMER" (SYS.11.01) by Greg Pfister, and for the graphics package, check out "MUDDLE CONSOLE GRAPHICS USER GUIDE" (SYS.11.11) by Neal Ryan. both docs are available from the Programming Technology Division at Project MAC πŸ“š

[;]MUDDLE<CR>                   ; Get a MUDDLE, ';' is MONIT prompt.
   ----------
MUDDLE 42 IN OPERATION.
LISTENING-AT-LEVEL 1 PROCESS 1
<FLOAD "MUDDLE;MACSYM">$        ; Load the program from MUDDLE
------------------------        ; directory.
/METMUDGIN GOUT
GIN GOUT                        ; Harmless comments from MUDDLE.
"DONE"
<DIFF '<- <* .X <LOG .X>> .X>>$
-------------------------------
PLEASE BE PATIENT, MACSYMA LOADING MAY TAKE TIME
MACSYMA AT MIT-MATHLAB          ; Comments from the program.
<LOG .X>                        ; The result is a MUDDLE form.
<INTEGRATE '<LOG .X>>$
----------------------
SIN FASL DSK MACSYM BEING LOADED
LOADING DONE                    ; Comments from MACSYMA.
SCHATC FASL DSK MACSYM BEING LOADED
LOADING DONE
<- <* .X <LOG .X>> .X>          ; The answer again.
<SET A <INTEGRATE "X/(X^3+1)">>$; The input is in infix form.
--------------------------------
"LOG(X^2-X+1)/6+ATAN((2*X-1)/SQRT(3))/SQRT(3)-LOG(X+1)/3"
                                ; The answer now is in infix form.
<SET B <DIFF .A>>$
------------------
"2/(3*((2*X-1)^2/3+1))+(2*X-1)/(6*(X^2-X+1))-1/(3*(X+1))"
<SIMPLIFY .B>$
--------------
"X/(X^3+1)"                     ; We get back the original expression.
<EXPAND '<^ <+ .X 2> 5>>$
-------------------------
<+ <+ <+ <+ <+ <^ .X 5> <* 10 <^ .X 4>>> <* 40 <^ .X 3>>>
<* 80 <^ .X 2>>> <* 80 .X>> 32>
<INTEGRATE '<EXP <^ .X 2>>>$
----------------------------
RISCH FASL DSK MACSYM BEING LOADED
LOADING DONE
*ERROR*                         ; Program recognizes that MACSYMA
CANT-INTEGRATE                  ; couldn't integrate.
LISTENING-AT-LEVEL 2 PROCESS 1
<ERRET>$                        ; To get back to level 1.
--------
LISTENING-AT-LEVEL 1 PROCESS 1
<DIS>$          ; We disconnect here to show the verbose mode,
------          ; the program disconnects automatically on quitting.
"CONNECTIONS CLOSED NOW"
<VERBOSE>$
----------
"YOU WILL BE ABLE TO OBSERVE MUDDLE-MACSYMA INTERACTION NOW"
<DIFF '<^ .X 3>>$
-----------------
PLEASE BE PATIENT, MACSYMA LOADING MAY TAKE TIME
MIT MATHLAB PDP-10 STELNT.59
ML ITS.1. DDT.516.
10. USERS
:LOGIN 70GUEST          ; The program uses User's SNAME (GUEST here).
:MACSYMA
THIS IS MACSYMA 226
SEE UPDATE > MACSYM; FOR CHANGES
FIX 226 DSK MACSYM BEING LOADED
LOADING DONE
(C1)
MACSYMA AT MIT-MATHLAB          ; The program announces MACSYMA,
 STRING (DIFF ((X^3),X,1));     ; and sends input in infix form.
(D1)                                   3*X^2
<* 3 <^ .X 2>>                  ; The output is in MUDDLE prefix form.
<INTEGRATE '</ .X <+ .X 1>>>$
-----------------------------
C2) STRING (INTEGRATE ((X/(X+1)),X));
SIN FASL DSK MACSYM BEING LOADED
LOADING DONE
SCHATC FASL DSK MACSYM BEING LOADED
LOADING DONE
(D2)                                 X-LOG(X+1)
<- .X <LOG <+ .X 1>>>           ; The output again.
<TERSE>$
--------
"OK"                            ; Back in TERSE mode now.

<FLOAD "MUDDLE;UGRF">$          ; To load graphics program
----------------------
IMLAC? (ANSWER Y OR N) Y        ; for graphics on an IMLAC.
                       -

"DONE"
<GRAPH <SLT A '<^ <SIN .X> 2>> X -3 3>$
---------------------------------------
        ; To graph function sin(X)^2 (graph 1 on Figure 1).
<GRAPH  <DIFF .A>>$
-------------------
        ; To graph diff of sin(X)^2 (see graph 2, Figure 1).
<GRAPH <INTEGRATE .A>>$
-----------------------
        ; To graph integral of sin(X)^2 (see graph 3, Figure 1).
<QUIT>$                         ; To quit from program and MUDDLE.
-------
KILL
[;]                     ; semicolon prompt from MONIT.

and here's the payoff, the graphs you'd get out of that last bit 🌈 the figure is captioned like this:

     FIG 1.  GRAPH FOR SIN(X)^2, DIFF(SIN(X)^2), AND INTEGRATE(SIN(X)^2)


                                --+--2.0
                                  |
                                  |
                                  |                        +++ (3)
                                  |                    ++++
                                  |                  ++
                                  |                 +
                                  |               ++
             ooo   ****         --+--   ooo   ***+
            o   o**    **         |    o   o**  + **
           o    *o       *        |   o    *o  +    *
          o    *          *       |  o    *   +      *
         o    *   o        *      | o    *   o        *
             *     o        *     |     *   + o        *
        o  **                **   |o  **  ++            **
|         *      |  o          *  |  *  ++     o   |      *   (1)   |
|-------**-------+-----------+++++o+++++-----------+-------**-------|
|-4.0            |   o     ++     |             o  |          (2)   |4.0
                         ++      o|                         o
                      o +         |              o
                       o        o |               o        o
                      +        o  |                       o
                     +  o     o   |                o     o
                    +    o   o    |                 o   o
                   +      ooo   --+-- -1.0           ooo
                 ++               |
                +                 |
              ++                  |
          ++++                    |
       +++                        |
                                  |
                                  |
                                --+-- -2.0

[ This RFC was put into machine readable form for entry ] [ into the online RFC archives by Graeme Hewson 3/98 ]

πŸ“¦ where this page comes from