Ask Your Question
1

How to show more results in sagemathcell?

asked 2019-05-26 14:47:46 +0200

John Bao gravatar image

updated 2019-05-27 03:31:16 +0200

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

edit retag flag offensive close merge delete

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 ( 2019-09-08 08:53:38 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-05-26 15:57:34 +0200

FrédéricC gravatar image

Like that:

[1+2, 10+20, 100+200]
edit flag offensive delete link more

Comments

Or simply

1+2, 10+20, 100+200

Or even

1+2,\
10+20,\
100+200
Juanjo gravatar imageJuanjo ( 2019-05-26 18:29:14 +0200 )edit

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 ( 2019-05-27 03:27:09 +0200 )edit
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 ( 2019-05-27 13:04:35 +0200 )edit

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

John Bao gravatar imageJohn Bao ( 2019-05-30 05:33:14 +0200 )edit

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: 2019-05-26 14:47:46 +0200

Seen: 742 times

Last updated: May 27 '19