[IPython-user] embedding in C program

Flavio Coelho fccoelho@gmail....
Tue Oct 21 05:18:30 CDT 2008


As far as I Know, you can call mathematica from Sage, can't you?
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?

look at this blog post:

http://sagemath.blogspot.com/2007/12/sage-mathematica-and-hiking-to-vultee.html

and also this section of the sage reference manual:

http://sagemath.org/doc/ref/module-sage.interfaces.mathematica.html

my 2 cents,

Flavio

On Mon, Oct 20, 2008 at 10:49 PM, Amir <amirnntp@gmail.com> wrote:

> Amir <amirnntp <at> gmail.com> writes:
>
> >
> > Hello.
> >
> > I have embedded the Python interpreter in a C program. I would like to
> also
> > embed IPython to take advantage of it's many features.
> >
> > 1. I have the following basic program working, which starts up an IPython
> shell
> > from within a C program.
> >
> > #include "Python.h"
> >
> > main(int argc, char **argv)
> > {
> >   Py_Initialize();
> >
> >   PySys_SetArgv(argc, argv);
> >   PyRun_SimpleString("from IPython.Shell import IPShellEmbed\n");
> >   PyRun_SimpleString("ipshell = IPShellEmbed()\n");
> >   PyRun_SimpleString("ipshell()\n");
> >
> >   Py_Finalize();
> > }
> >
> > 2. Now, I would like to run commands through the IPython shell using the
> Python
> > C api with Py_CompileString and PyEval_EvalCode and read the result using
> > commands like PyArray_Check for a returned numpy array.
> >
> > After instantiating an ipshell, is there a way to start it and pass
> commands to
> > it using the C api and read from the __main__ dict? Running ipshell()
> will just
> > start the interpreter and I wont be able to further call it from C.
> >
> > Thanks,
> > Amir.
> >
>
> I'd like to add if anyone happens to be interested that this is part of a
> Mathematica linked module that allows starting a python shell and calling
> python
> functions transparently from Mathematica. I would like to interact with an
> ipython shell rather than a python shell.
>
> So far, what I have working is automatic recognition of numpy array types
> and
> matplotlib plotting functions as well as the built-in Python types (lists,
> tuples, booleans, etc). These are trivial extensions to the existing
> Pythonika
> package:
>
> http://dkbza.org/pythonika.html
>
> In case you use Mathematica, this is handy because, among other things:
>
> - you have the mathematica notebook interface to record results and plots,
> - you can call scipy functions where no counterpart exists in Mathematica
> (like
> some signal processing functions),
> - call R or cvxopt,
> - call Sage (haven't done this yet).
>
>
>
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
>



-- 
---
Flávio Codeço Coelho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20081021/f98553d5/attachment.html 


More information about the IPython-user mailing list