CSympy and C++

224 views
Skip to first unread message

Matheus Queiroz

unread,
Apr 20, 2015, 12:49:01 PM4/20/15
to sy...@googlegroups.com
Hi!
I'm a undergraduate student in need of a symbolic library.
I know enough C++ and Qt Framework to get into some "adventures".
I heard about sympy and I simply loved it. It's simple, efficient and has everything that I currently need.
My question:

Can I use it in C++?
If yes... is there any documentation on how to use it in C++ code?

Sorry, folks. But I really have no time to learn Python up to the level I am currently programming in C++ (Not to mention that my scientific work uses a lot of matrices that are dynamically allocated).

Ondřej Čertík

unread,
Apr 20, 2015, 12:54:44 PM4/20/15
to sympy
Hi Matheus,

On Mon, Apr 20, 2015 at 10:48 AM, Matheus Queiroz <k9de...@gmail.com> wrote:
> Hi!
> I'm a undergraduate student in need of a symbolic library.
> I know enough C++ and Qt Framework to get into some "adventures".
> I heard about sympy and I simply loved it. It's simple, efficient and has
> everything that I currently need.

Thanks, I am glad you like it.

> My question:
>
> Can I use it in C++?

You can call Python from C++ (using Cython or by hand using Python
C/API) if that is what you want.

> If yes... is there any documentation on how to use it in C++ code?

I found documentation how to call Python from C or C++ here:

https://docs.python.org/2/extending/embedding.html

> Sorry, folks. But I really have no time to learn Python up to the level I am
> currently programming in C++ (Not to mention that my scientific work uses a
> lot of matrices that are dynamically allocated).

I would mention that Python is very easy to learn, compared to C++,
and I would definitely recommend it to you. You can use NumPy for
dynamically allocated matrices and arrays.

That being said, we also have a pure C++ library:
https://github.com/sympy/csympy, and you can use it directly from C++
without any Python dependency. But it currently only has a subset of
all the SymPy functionality. To get a full featured computer algebra
system, use SymPy from Python. Use CSymPy if SymPy in Python is too
slow for your application.

Ondrej

Matheus Queiroz

unread,
Apr 21, 2015, 12:12:44 PM4/21/15
to sy...@googlegroups.com
Thanks a lot, Ondřej.
That will do the work just fine.
Reply all
Reply to author
Forward
0 new messages