As far as I Know, you can call mathematica from Sage, can't you?<div><br></div><div>considering that Sage already gives you Python, Ipython and a notebook much like Mathematica's, wouldn't be easier just to use Sage, and call Mathematica when you need?</div>
<div><br></div><div>look at this blog post:</div><div><br></div><div><a href="http://sagemath.blogspot.com/2007/12/sage-mathematica-and-hiking-to-vultee.html">http://sagemath.blogspot.com/2007/12/sage-mathematica-and-hiking-to-vultee.html</a><br>
</div><div><br></div><div>and also this section of the sage reference manual:</div><div><br></div><div><a href="http://sagemath.org/doc/ref/module-sage.interfaces.mathematica.html">http://sagemath.org/doc/ref/module-sage.interfaces.mathematica.html</a><br>
</div><div><br></div><div>my 2 cents,</div><div><br></div><div>Flavio <br><br><div class="gmail_quote">On Mon, Oct 20, 2008 at 10:49 PM, Amir <span dir="ltr"><<a href="mailto:amirnntp@gmail.com">amirnntp@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Amir <amirnntp <at> <a href="http://gmail.com" target="_blank">gmail.com</a>> writes:<br>
<br>
><br>
> Hello.<br>
><br>
> I have embedded the Python interpreter in a C program. I would like to also<br>
> embed IPython to take advantage of it's many features.<br>
><br>
> 1. I have the following basic program working, which starts up an IPython shell<br>
> from within a C program.<br>
><br>
> #include "Python.h"<br>
><br>
> main(int argc, char **argv)<br>
> {<br>
> Py_Initialize();<br>
><br>
> PySys_SetArgv(argc, argv);<br>
> PyRun_SimpleString("from IPython.Shell import IPShellEmbed\n");<br>
> PyRun_SimpleString("ipshell = IPShellEmbed()\n");<br>
> PyRun_SimpleString("ipshell()\n");<br>
><br>
> Py_Finalize();<br>
> }<br>
><br>
> 2. Now, I would like to run commands through the IPython shell using the Python<br>
> C api with Py_CompileString and PyEval_EvalCode and read the result using<br>
> commands like PyArray_Check for a returned numpy array.<br>
><br>
> After instantiating an ipshell, is there a way to start it and pass commands to<br>
> it using the C api and read from the __main__ dict? Running ipshell() will just<br>
> start the interpreter and I wont be able to further call it from C.<br>
><br>
> Thanks,<br>
> Amir.<br>
><br>
<br>
I'd like to add if anyone happens to be interested that this is part of a<br>
Mathematica linked module that allows starting a python shell and calling python<br>
functions transparently from Mathematica. I would like to interact with an<br>
ipython shell rather than a python shell.<br>
<br>
So far, what I have working is automatic recognition of numpy array types and<br>
matplotlib plotting functions as well as the built-in Python types (lists,<br>
tuples, booleans, etc). These are trivial extensions to the existing Pythonika<br>
package:<br>
<br>
<a href="http://dkbza.org/pythonika.html" target="_blank">http://dkbza.org/pythonika.html</a><br>
<br>
In case you use Mathematica, this is handy because, among other things:<br>
<br>
- you have the mathematica notebook interface to record results and plots,<br>
- you can call scipy functions where no counterpart exists in Mathematica (like<br>
some signal processing functions),<br>
- call R or cvxopt,<br>
- call Sage (haven't done this yet).<br>
<br>
<br>
<br>
_______________________________________________<br>
IPython-user mailing list<br>
<a href="mailto:IPython-user@scipy.org">IPython-user@scipy.org</a><br>
<a href="http://lists.ipython.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://lists.ipython.scipy.org/mailman/listinfo/ipython-user</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>---<br>Flávio Codeço Coelho<br>
</div>