First time here? Check out the FAQ!

Ask Your Question
1

How to show more results in sagemathcell?

asked 5 years ago

John Bao gravatar image

updated 5 years ago

If I put following comand in http://sagemath.askplanck.cn/

1+2
10+20
100+200

If Evaluate above command, I can only get last result: 300. What I wish is too get 3 results one by one in my own sagemath server , How can I do in configure file.

In https://cocalc.com/, if I put above comand, it shows 3 results. This is nice,and is what I want. Is it possible in such like sagmathcell?

PS. I don't want to put command as following (which can show 3 results):

print 1+2
print 10+20
print 100+200

Thank you very much for your suggestion.

John

Preview: (hide)

Comments

Thanks slelievre, is it possible to display full output in sagemathcell (not in Jupyter), not only last result? @slelievre

John Bao gravatar imageJohn Bao ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 5 years ago

FrédéricC gravatar image

Like that:

[1+2, 10+20, 100+200]
Preview: (hide)
link

Comments

Or simply

1+2, 10+20, 100+200

Or even

1+2,\
10+20,\
100+200
Juanjo gravatar imageJuanjo ( 5 years ago )

Thank you, FrédéricC and Juanjo. But your answers is not what I want. I wish the ouput has 3 lines. My example is for simplity, other example cannot be written as an array. Is there any other suggestion?

John Bao gravatar imageJohn Bao ( 5 years ago )
1

I don't know if you can configure your SagemathCell server to get what you want. Check the links given by @slelievre below your post. Anyway, you could rely on Python itself, saving results in variables and printing or showing them together at the end, like

a = 1+2
b = 10+20
c = 100+200
# and so on
output = [a,b,c] 
print ("{}\n"*len(output)).format(*output)
Juanjo gravatar imageJuanjo ( 5 years ago )

Thank you very much. I am working of @slelievre 's suggestion.

John Bao gravatar imageJohn Bao ( 5 years ago )

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 1,006 times

Last updated: May 27 '19