ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 14 Mar 2015 02:38:59 +0100pipe into stdin vs attach -- differences?https://ask.sagemath.org/question/26182/pipe-into-stdin-vs-attach-differences/ Here's some code, called `slopes.sage`:
def classical_slopes(N,p,r,k,i):
assert p>2
assert r>1 ## wild
G=DirichletGroup(p^r) ## cyclic
alpha=G[1]
alpha_tame=alpha^(p^(r-1))
alpha_wild=alpha^(p-1)
K=alpha.base_ring() ## cyclotomic
chi=alpha_tame^i*alpha_wild
C=CuspForms(chi.extend(N*p^r),k)
f=C.hecke_polynomial(p).base_extend(K)
R=K.maximal_order()
primroot=primitive_root(p) ## p>2
X=R.ideal(p,alpha_tame(primroot)-primroot).factor()
assert len(X)==1 ## ideal should be a prime power
Qt = PolynomialRing(QQ, 't')
P,e=X[0]
c2=[2^(a.valuation(P)) if a!=0 else 0 for a in f.coefficients()]
return (e,Qt(c2).newton_slopes(2))
# off we go. The import sys bit is to flush stdout.
import sys
N=3
p=5
for k in range(2,10):
i=4-(k%4)
print N,p,3,k,i,classical_slopes(N,p,3,k,i)
sys.stdout.flush()
If I pipe it into sage like this:
sage < slopes.sage
I get the following output:
$ sage < slopes.sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.5, Release Date: 2015-02-17 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: sage: sage: sage: sage: sage: ....: ....: ....: ....:
Exiting Sage (CPU time 0m0.03s, Wall time 0m0.20s).
But if I attach the file, within a sage console session, it runs as I expect it to run. Is this something to do with the pre-parser? If I've made a slip then that's great, but if it's harder than I think to pipe sage script into sage then I'd appreciate some tips as I would like to start a large sage job on a remote machine via ssh.Kevin BuzzardSat, 14 Mar 2015 02:38:59 +0100https://ask.sagemath.org/question/26182/running sage as an argument to ssh command causes interpreter shell to hanghttps://ask.sagemath.org/question/25315/running-sage-as-an-argument-to-ssh-command-causes-interpreter-shell-to-hang/ I have sage on a remote server, and I can ssh to that server and then run sage to get the interpreter. But when I run sage from the ssh command, sage hangs before I get the sage: command prompt. Like this:
$ ssh user@host sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.1.1, Release Date: 2014-02-04 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
I do not have admin rights on the server.
Ultimately, what I want to do is run the command
$ssh -t user@host1 '
screen -mS sage ssh host2 sh -c '\''cd /path/to/working/directory;sage'\'''
If you must know, it's because only host2 has sage and only host1 has screen. I have an unreliable connection to both, but they have a reliable connection between them.
The question: How can I get this to work?alejandroericksonSun, 21 Dec 2014 21:11:10 +0100https://ask.sagemath.org/question/25315/Accessing cloud via sshhttps://ask.sagemath.org/question/10624/accessing-cloud-via-ssh/Hi,
is it possible to log in to the home folder of a cloud-project via ssh?
I found [this](https://github.com/sagemath/cloud/wiki/FAQ#-question-i-created-an-ssh-key-in-my-project-how-do-i-easily-copy-it) in the FAQ of cloud.sagemath but it didn't help me very much :(
What I really would like to do is to sync a folder with some sage scripts on my PC with the cloud so I'm looking for something like:
rsync --delete -avze ssh ~/Sync/ user@cloud.sagemath.com:~/Sync/
So if ssh login is not possible also other possibilities to sync folders are welcome.
twchFri, 18 Oct 2013 09:38:48 +0200https://ask.sagemath.org/question/10624/connect to sage term (user password)https://ask.sagemath.org/question/10859/connect-to-sage-term-user-password/Hello,
I'm trying to connect to my home directory on the Sage Server. I've established a connection from the Sage terminal onto my computer (ssh). But the Sage terminal is working slow in the browser. So i want to connect from a terminal running on my machine to sage.
But what is the user name and what is the password to use? Is this my Registration login?
Do I type something like : ssh < Account First Name >@sagemath.org ?RalphThu, 26 Dec 2013 15:03:47 +0100https://ask.sagemath.org/question/10859/Unable to Connect to localhost:8000https://ask.sagemath.org/question/9123/unable-to-connect-to-localhost8000/I am trying to use Sage by SSH into my university's computer system. I succeeded in getting into the computer which has Sage installed on it. I am running SecureShellClient on a windows machine. However, when I try to actually run the program, I run into problems.
I type
$ sage -n
and get the following
----------------------------------------------------------------------
| Sage Version 4.5.3, Release Date: 2010-09-04 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
Please wait while the Sage Notebook server starts...
...
The notebook files are stored in: sage_notebook.sagenb
**************************************************
* *
* Open your web browser to http://localhost:8000 *
* *
**************************************************
2012-07-02 13:00:49-0500 [-] Log opened.
2012-07-02 13:00:49-0500 [-] twistd 9.0.0 (/usr/share/sage-4.5.3/local/bin/python 2.6.4) starting up.
2012-07-02 13:00:49-0500 [-] reactor class:
twisted.internet.selectreactor.SelectReactor.
2012-07-02 13:00:49-0500 [-] twisted.web2.channel.http.HTTPFactory starting on 8000
2012-07-02 13:00:49-0500 [-] Starting factory <twisted.web2.channel.http.HTTPFactory instance at 0xa6be8ec>
xprop: unable to open display ''
usage: xprop [-options ...] [[format [dformat]] atom] ...
where options include:
-grammar print out full grammar for command line
-display host:dpy the X server to contact
-id id resource id of window to examine
-name name name of window to examine
-font name name of font to examine
-remove propname remove a property
-set propname value set a property to a given value
-root examine the root window
-len n display at most n bytes of any property
-notype do not display the type field
-fs filename where to look for formats for properties
-frame don't ignore window manager frames
-f propname format [dformat] formats to use for property of given name
-spy examine window properties forever
When I try to open http://localhost:8000 in an in internet window, I get "Unable to Connect" from Firefox, and a similar message when I try to open it in Internet Explorer.
I'm very new to Sage and Linux, and have no idea what's going wrong here. I haven't been able to find any instructions on how to run Sage through ssh, so I'm wondering if I'm missing a step somewhere.
Thanks.
ec92Mon, 02 Jul 2012 15:20:16 +0200https://ask.sagemath.org/question/9123/plot in sage console, through an ssh connection, with the LiveCdhttps://ask.sagemath.org/question/8755/plot-in-sage-console-through-an-ssh-connection-with-the-livecd/I'm a Windows user, and I use sage with the Live Cd, version 4.8.
I use putty.exe to connect to the virtual machine, login as sage, and run the sage console.
I would like to plot from the sage console, through this ssh connection.
I've followed [this](http://wiki.yobi.be/wiki/Sage#SAGE_console_via_ssh) guide to enable X11forwarding on the VM, and [this](https://docs.rice.edu/confluence/display/ITTUT/SSH+with+X11+forwarding+on+Windows) guide to setup X11forwarding on the Windows machine.
When I run a simple script from within the sage environment like
var('x')
f(x)=x**2
plot(f,(x,0,2))
the plot command returns without any error, but no window is created. I've also tried to run from the bash console, before entering the sage environment, this command:
export DISPLAY=0.0
without any improvement. I actually don't even know if X11 forwarding is working, because I can't find any X program on the livecd like xclock, xeyes, etc. to test them.
EDIT:
I've installed xeyes on the live cd, and it doesn't open. Running a netstat or a top, I can't see any sign of the X server running. I think the live CD DOES NOT HAVE AN INSTALLED X SERVER. This settles the question, at least partially. Instead of trying to install the X server on the sage live cd, I'll start with a virtual machine with X preinstalled, and then install Sage. I'll report back here when done.atariTue, 28 Feb 2012 11:23:14 +0100https://ask.sagemath.org/question/8755/sage notebook server + ssh tunneling + port forwardinghttps://ask.sagemath.org/question/8436/sage-notebook-server-ssh-tunneling-port-forwarding/I have access to a remote server through a gate computer with this command:
ssh -fN -l user -L port:host:22 gate #To Bring up the tunnel
ssh -X -p port user@localhost #To open an X session to my server
Once on the server I run sage by typing "./sage" in the installation directory. Now the questions:
1)Which are the right commands to bring up the remote notebook server?
2)What should I type in my local browser? (I suppose something like 'localhost:port', but even without launching the notebook server I get the following error:'SSH-2.0-OpenSSH_4.3 Protocol mismatch')
I tried to read the instructions and the wiki, but I confess that I am at a loss.
Thanks a lot
GiovanniGiovanniThu, 03 Nov 2011 18:01:41 +0100https://ask.sagemath.org/question/8436/