plain method:
ssh and execute
math
to enter a mathematica terminal mode session (sans front end)
On Aug 14, 12:40 pm, "PaulOlivierS...@gmail.com"
#!/bin/sh
exec ssh -t myMathem...@myMathematicaServer.DomainName.com math
$*
You need to setup some sort of password-less authentication from your
laptop to the mathematica server if you have not already. There are
lots of simple ways to do this. Two easy and elementary ways are the
ControlMaster option or the program ssh-agent, as described in the man
pages for ssh_config and ssh-agent.
I don't have access to mathematica, but this works for gap, kash, and
magma.
On Aug 14, 4:48 pm, "PaulOlivierS...@gmail.com"
sage: m = Mathematica(server="name.of.computer.edu")
William
--
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org
Thanks! After some sweat it worked. The main pain is that I can't
actually ssh directly to the machine running mathematica (speedy-
gonzales) when I am at home, I need to tunnel through yet another
machine (gate). This is the math* script:
#!/bin/sh
ssh -t gate.maths.ox.ac.uk "source .ssh-agent.sh;ssh -t speedy-
gonzales.maths.ox.ac.uk math"
The console, the interface and the interactive modes work (for
mathematica so far). The only thing is that when quitting the
console() it's not clean. SAGE hangs for a while, but reacts after a
few key presses:
sage: mathematica.console()
Pseudo-terminal will not be allocated because stdin is not a
terminal.
Agent pid
32110
<-------------------------------------------- my ssh-agent is started
Pseudo-terminal will not be allocated because stdin is not a terminal.
Mathematica 5.2 for Linux
Copyright 1988-2005 Wolfram Research, Inc.
-- Terminal graphics initialized --
In[1]:= Quit
<-------------------------------------------- Nothing happens so I
press a few times Enter
---------------------------------------------------------------------------
<type 'exceptions.IOError'> Traceback (most recent call
last)
/Users/pdehaye/<ipython console> in <module>()
/Library/sage/local/lib/python2.5/site-packages/sage/interfaces/
mathematica.py in console(self, readline)
393
394 def console(self, readline=True):
--> 395 mathematica_console(readline=readline)
396
397 def trait_names(self):
/Library/sage/local/lib/python2.5/site-packages/sage/interfaces/
mathematica.py in mathematica_console(readline)
495 line = raw_input(' ')
496 f1.writelines(line+'\n')
--> 497 f1.flush()
498 except KeyboardInterrupt:
499 f1.close()
<type 'exceptions.IOError'>: [Errno 32] Broken pipe
sage:
sage:
sage:
What happens if you try inputing something very large, e.g., with
a few thousand digits, e.g.,
mathematica(10^10000)?
SAGE normally uses files to send large input, and with the "server=" option
it would use scp, but with a "fake" math command line, I don't think files
will work at all. So unfortunately with what you're doing below probably
anything involving large input will fail.
That said, it is a very intriguing problem to make the SAGE interfaces work
even when there are arbitrarily many hops between you and the math software.
On Aug 15, 4:19 pm, "William Stein" <wst...@gmail.com> wrote:
You could try implementing this. Take a look at
SAGE_ROOT/devel/sage/sage/interfaces/expect.py
and
SAGE_ROOT/devel/sage/sage/interfaces/mathematica.py
Do a text search for "scp" in there. Make changes and do
"sage -br" to start SAGE with the changes in effect.
William
On Aug 16, 3:20 am, "William Stein" <wst...@gmail.com> wrote:
Host remote_for_sage
ProxyCommand ssh gateway nc -w 1 remote 22
and that (along with all the passwordless authentication associated)
does the trick.
It essentially tells my ssh to create a new virtual host called
"remote_for_sage", so that
- "ssh remote_for_sage" will actually return a SSH connection to
"remote", but through the machine "gateway"
- "ssh -t remote_for_sage magma" will similarly run magma on
"remote" through "gateway"
- "ssh remote" is not affected at all (and in my case won't work,
as "remote" is shielded by "gateway", that was the point)
- "scp remote_for_sage" will *also* be tunneled through
"gateway" (that's the power of ProxyCommand)
So when I do
sage: magma = Magma(server = "remote_for_sage")
, that ssh_config takes care of everything and the fact that it is
tunneled through gateway is entirely transparent to sage.
Paul
On Aug 16, 9:26 am, "PaulOlivierS...@gmail.com"
Paul,
It would be great if you could add this discussion (in latex-ish format)
to the file SAGE_ROOT/devel/sage/sage/interfaces/expect.py (and
post a patch). Then people reading the reference manual about the
interfaces could have a reasonable chance of doing what you did.
-- William
On Aug 20, 1:36 am, "William Stein" <wst...@gmail.com> wrote: