Ask Your Question

Interact with SAGE over TCP

asked 2013-06-09 00:15:32 -0500

iposov gravatar image

I am going to write a Java program that interacts with Sage. With Wolfram Mathematica I would have used a MathLink interface for this purpose. Does Sage have something similar?

Goolge suggests there is some way to interact over TCP with JSON queries and responses, but the Sage tutorial states only 4 ways of using Sage:

You can use Sage in several ways.

  • Notebook graphical interface: see the section on the Notebook in the reference manual and The Notebook Interface below,
  • Interactive command line: see The Interactive Shell,
  • Programs: By writing interpreted and compiled programs in Sage (see Loading and Attaching Sage ?les and Creating Compiled Code), and
  • Scripts: by writing stand-alone Python scripts that use the Sage library (see Standalone Python/Sage Scripts).
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-06-09 02:34:30 -0500

Volker Braun gravatar image

Yet another option is to write your own TCP server in Sage and have it eval() the input and return it in JSON. All the necessary Python modules are already included.

edit flag offensive delete link more

answered 2013-06-10 00:38:11 -0500

Jason Grout gravatar image

The Sage Cell Server provides a framework for a JSON service to interact with Sage. Also, William published a Sage tcp-based service server in the code he released from Sage Cloud:

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


Asked: 2013-06-09 00:15:32 -0500

Seen: 79 times

Last updated: Jun 10 '13