Help with understanding and setting up Sage Cell Server

43 views
Skip to first unread message

Jole Bradbury

unread,
Jul 2, 2014, 1:14:44 PM7/2/14
to sage-s...@googlegroups.com
Hi all,

I've done some work in Java, HTML, CSS, JavaScript, ActionScript 3.0 and recently Python.

I have a project I'm working on where I'd like to set up a very simple Sage server, to function as follows: The server will receive Sage or Maxima code, execute the code, and send back the result. Example, sending "integrate(1,x)" to the server would return "x".

However, I have found myself getting a little lost in the process, I am not quite used to server-side scripting yet. The questions I'd like answered are:

1) Am I using the correct tool for the process, or is there an easier way to do this? I don't want a graphical interface on a website, I only want a server.

2) I've noticed on the Sage Cell Server demo online that typing Maxima code will result in every line being evaluated but Sage code only evaluates the last line. For example, 
integrate(1,x)
integrate(2,x)
In "Sage" code will return: 2
In Maxima will return :
1
2
Therefore, since I am more familiar with Maxima code I would like to set up the server to use Maxima code. Is this easily possible?

3) Is writing Python code required for this task?

4) How simple would the task be, of setting up a simple server like this? In Sage? In Maxima? Any resources would be appreciated.

Thank you very much.

Nils Bruin

unread,
Jul 3, 2014, 1:43:36 AM7/3/14
to sage-s...@googlegroups.com
On Wednesday, July 2, 2014 10:14:44 AM UTC-7, Jole Bradbury wrote:
2) I've noticed on the Sage Cell Server demo online that typing Maxima code will result in every line being evaluated but Sage code only evaluates the last line. For example, 
integrate(1,x)
integrate(2,x)
In "Sage" code will return: 2
All lines do execute. It's just only printing the result of the last line (I wouldn't mind if that got changed). If you try

print integrate(1,x)
print integrate(2,x)

you'll see both results.
 (I can't help you with the other questions, but hopefully having this little fact corrected is also helpful somehow)

William Stein

unread,
Jul 3, 2014, 1:59:50 AM7/3/14
to sage-support
For what it is worth, the Sage Notebook and Sage Cell work that way
because at the time (2006) that we implemented the first version, we
couldn't figure out how to get it to work the way Jole wants. And
that weird design just sort of stuck.

In SageMathCloud, doing

integrate(1,x)
integrate(2,x)

outputs

x
2*x

It does this properly by breaking the input into blocks, and exec'ing
each block separately. I think SageCell (and IPython Notebook,
etc.) should do the same, but nobody listens to me when I suggest
this.

-- William

Jole Bradbury

unread,
Jul 3, 2014, 11:28:08 AM7/3/14
to sage-s...@googlegroups.com
Is SageMathCloud a better way to do this sever thing? Can you answer any of my other questions?

William Stein

unread,
Jul 3, 2014, 3:14:06 PM7/3/14
to sage-support
On Thu, Jul 3, 2014 at 8:28 AM, Jole Bradbury <eghb...@miamioh.edu> wrote:
> Is SageMathCloud a better way to do this sever thing? Can you answer any of
> my other questions?

I'm sorry -- I probably shouldn't have made any remarks in this
thread. I was only specifically commenting on the issue (output
printing) that I commented on, not suggesting a different approach.
Please disregard my comments.

-- William
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages