Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sage and nohup

Does anyone understand why the code below, saved in the file input.txt, does not work when it is run with the command

nohup sage < input.txt > output.txt &

(Of course, I use * for the product but it does not appear properly here)?

import sage.combinat.lyndon_word as LW

from sage.combinat.words.shuffle_product import ShuffleProduct_w1w2 as SP

from sage.combinat.free_module import CombinatorialFreeModule as CFM

F=CFM(QQ, ['a','b'])

R.<a,b>=FreeAlgebra(QQ,2)

Module=CombinatorialFreeModule(F.base_ring(),R)

def TP_free_algebra(w1,w2): if type(w1)==Integer: if type(w2)==Integer: return w1w2tensor((Module.basis()[1],Module.basis()[1])) else: L2=list(w2) result=0 for i in L2: result+=w1i[0]tensor((Module.basis()[1],Module.basis()[i[1]]))
return result else: if type(w2)==Integer: L1=list(w1) result=0 for i in L1: result+=w2i[0]tensor((Module.basis()[i[1]],Module.basis()[1]))
return result else: L1=list(w1) L2=list(w2) result=0 for i in L1: for j in L2: result+=i[0]j[0]tensor((Module.basis()[i[1]],Module.basis()[j[1]])) return result

TP_free_algebra(Word('a'),Word('b'))

sage and nohup

Does anyone understand why the code below, saved in the file input.txt, does not work when it is run with the command

nohup sage < input.txt > output.txt &

(Of course, I use * for the product but it does not appear properly here)?

import sage.combinat.lyndon_word as LW

LW from sage.combinat.words.shuffle_product import ShuffleProduct_w1w2 as SP

SP from sage.combinat.free_module import CombinatorialFreeModule as CFM

CFM F=CFM(QQ, ['a','b'])

R.<a,b>=FreeAlgebra(QQ,2)

Module=CombinatorialFreeModule(F.base_ring(),R)

['a','b']) R.<a,b>=FreeAlgebra(QQ,2) Module=CombinatorialFreeModule(F.base_ring(),R) def TP_free_algebra(w1,w2): if type(w1)==Integer: if type(w2)==Integer: return w1w2tensor((Module.basis()[1],Module.basis()[1])) w1*w2*tensor((Module.basis()[1],Module.basis()[1])) else: L2=list(w2) result=0 for i in L2: result+=w1i[0]tensor((Module.basis()[1],Module.basis()[i[1]]))
result+=w1*i[0]*tensor((Module.basis()[1],Module.basis()[i[1]])) return result else: if type(w2)==Integer: L1=list(w1) result=0 for i in L1: result+=w2i[0]tensor((Module.basis()[i[1]],Module.basis()[1]))
result+=w2*i[0]*tensor((Module.basis()[i[1]],Module.basis()[1])) return result else: L1=list(w1) L2=list(w2) result=0 for i in L1: for j in L2: result+=i[0]j[0]tensor((Module.basis()[i[1]],Module.basis()[j[1]])) return result

TP_free_algebra(Word('a'),Word('b'))

result+=i[0]*j[0]*tensor((Module.basis()[i[1]],Module.basis()[j[1]])) return result TP_free_algebra(Word('a'),Word('b'))