Writing the core in C++

4 views
Skip to first unread message

Ondrej Certik

unread,
Nov 12, 2007, 11:24:44 AM11/12/07
to symp...@googlegroups.com, sy...@googlegroups.com
Hi,

I know one student, that would be interested in writing the core in
C++ as part of his Bachelor thesis (I could be his advisor). His
current code is here:

http://code.google.com/p/sympy-cpp/

(sorry the page is in Czech only, but you can browse the code in Source tab)

What do you think about it? Is SymPy, or sympycore in a state, so that
we know how to do it in C++, so that it would help the project? If so,
how would you approach the problem? What exact functionality should be
implemented and how? My idea is just to try to implement the very
basic functionality:

Add, Mul, Pow, Symbol, series expansion, substitution, maybe a pattern
matching and wrap it in Python using the same interface as we use.

Unfortunately, we need to decide very quickly, like till tomorrow, or
Wednesday. If you could write me your opinions about it, it'd be
awesome.

Thanks a lot,
Ondrej

Ondrej Certik

unread,
Nov 20, 2007, 5:10:18 PM11/20/07
to sy...@googlegroups.com, symp...@googlegroups.com
Hi Jim,

> One of the advantages of SymPy -- and one of the reasons to write it
> in python -- was to ensure it was easy to read, and easy to modify.

Yes, this goal definitely stays.

> It might make sense to write some classes it C (or C++), but ... at
> what point does SymPy become redundant to the packages that are
> already out there (or to Sage, as the glue)?

The C++ code is just a research project. Currently, there is GiNaC,
Giac and eigenmath, but we want to see if we can do it the same way as
in SymPy, but in C++ or C for speed.

SymPy will stay as a pure Python library, because the advantage of
being pure Python is just too big to lose. Nevertheless, the speed is
not optimal for some applications, so the only way out of it is to
provide some speedup. As an optional module, or core, or whatever, for
people who need it. For the others, pure Python is enough.

As to SymPy and SAGE - you can read some discussion how to do
SAGE.calculus here:

http://groups.google.com/group/sage-devel/browse_thread/thread/2308561f175a0674

My original motivation why I started SymPy was because I wanted easy
to use but general CAS in Python, easily extensible, etc, etc. So to
have something now, I started in pure Python. It turned out it's
useful even in pure Python. However, the project with the biggest
potential right now is SAGE, it's around 10x bigger in terms of
developers and users, maybe more (but it's also true that SAGE has
much wider scope than SymPy) . So I also want SymPy to be part of
SAGE, so that people can choose the best alternative (Maxima wrappers
or SymPy), whatever works better for them.

I think the right way to write programs is to start in Python, and
later (when you know how) rewrite some parts to C, or C++ or Cython to
gain the maximum possible speed. But this is still far future.

Ondrej

Reply all
Reply to author
Forward
0 new messages