# Revision history [back]

### 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.