Ask Your Question
0

sage and nohup

asked 2012-01-14 08:37:45 +0200

Matthieu Deneufchâtel gravatar image

updated 2012-01-16 08:50:40 +0200

niles gravatar image

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 w1*w2*tensor((Module.basis()[1],Module.basis()[1]))
    else:
      L2=list(w2)
      result=0
      for i in L2:
        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+=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'))
edit retag flag offensive close merge delete

Comments

Concerning `*`: Why don't you use the editor to format code like code?

Simon King gravatar imageSimon King ( 2012-01-14 08:58:58 +0200 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2012-01-30 09:45:18 +0200

Matthieu Deneufchâtel gravatar image

My code works without nohup. I don't why, but I could not make it work with it, so I used the screen command and was able to do what I want. Thanks for your answer anyway.

edit flag offensive delete link more
0

answered 2012-01-16 08:54:50 +0200

niles gravatar image

Does it work without nohup? I haven't used "<" in my nohupped sage jobs -- what is it supposed to do? Also, why not use .sage instead of .txt? I would try

nohup sage input.sage > output.txt &

(after copying input.txt to input.sage)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-01-14 08:37:45 +0200

Seen: 581 times

Last updated: Jan 30 '12