Ask Your Question
1

How to show more results in sagemathcell?

asked 2019-05-26 07:47:46 -0600

John Bao gravatar image

updated 2019-05-26 20:31:16 -0600

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 01:53:38 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2019-05-26 08:57:34 -0600

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 11:29:14 -0600 )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-26 20:27:09 -0600 )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 06:04:35 -0600 )edit

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

John Bao gravatar imageJohn Bao ( 2019-05-29 22:33:14 -0600 )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 07:47:46 -0600

Seen: 74 times

Last updated: May 26