ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 10 Jun 2013 07:38:11 +0200Interact with SAGE over TCPhttps://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/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).Sun, 09 Jun 2013 07:15:32 +0200https://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/Answer by Jason Grout for <p>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?</p>
<p>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:</p>
<hr/>
<p>You can use Sage in several ways.</p>
<ul>
<li>Notebook graphical interface: see the section on the Notebook in the reference manual and The Notebook
Interface below,</li>
<li>Interactive command line: see The Interactive Shell,</li>
<li>Programs: By writing interpreted and compiled programs in Sage (see Loading and Attaching Sage ?les and
Creating Compiled Code), and</li>
<li>Scripts: by writing stand-alone Python scripts that use the Sage library (see Standalone Python/Sage Scripts).</li>
</ul>
https://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/?answer=15050#post-id-15050The [Sage Cell Server](http://sagecell.sagemath.org) 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: [https://github.com/sagemath/cloud](https://github.com/sagemath/cloud)Mon, 10 Jun 2013 07:38:11 +0200https://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/?answer=15050#post-id-15050Answer by Volker Braun for <p>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?</p>
<p>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:</p>
<hr/>
<p>You can use Sage in several ways.</p>
<ul>
<li>Notebook graphical interface: see the section on the Notebook in the reference manual and The Notebook
Interface below,</li>
<li>Interactive command line: see The Interactive Shell,</li>
<li>Programs: By writing interpreted and compiled programs in Sage (see Loading and Attaching Sage ?les and
Creating Compiled Code), and</li>
<li>Scripts: by writing stand-alone Python scripts that use the Sage library (see Standalone Python/Sage Scripts).</li>
</ul>
https://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/?answer=15039#post-id-15039Yet 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.Sun, 09 Jun 2013 09:34:30 +0200https://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/?answer=15039#post-id-15039