Hi Ardi,
On Mon, Jan 16, 2017 at 3:04 AM, ardi <
ardillas...@gmail.com> wrote:
> Hi,
>
> Searching the net, I found several questions similar to mine, but I didn't
> find any recommended procedure, or detailed steps for achieving it:
>
> I'd like to use some of the SymPy functionality from my C++ programs. In
> particular, my current needs would be evaluating physics formulas with units
> (I mean variables have units) and solving linear and quadratic equations
> (also with units) and systems of linear equations, as well as converting the
> expressions to LaTeX syntax. These are my current needs, but in a mid-term
> future I foresee the need to also evaluate physics formulas that work with
> matrices and vectors, and differentiation/integration.
>
> Should I use Symengine for this, or is it not finished yet for these tasks?
I think we do not have units support in SymEngine. We can solve linear systems:
https://github.com/symengine/symengine/blob/9a20615f493f071c778bd40ea42bbe7a278e0aec/symengine/matrix.h#L184
I think we don't have quadratic equations yet, but that's easy to
implement. We don't have a LaTeX output yet, but it's easy to add,
simlar to the StrPrinter:
https://github.com/symengine/symengine/blob/6f9ab96903c3f911d31f4e7f605def986a48996b/symengine/printer.h#L180
We have differentiation, matrices and vectors. We don't have integration yet.
>
> If the recommendation is to directly use SymPy 1.0, is there any C++ (or C)
> sample code that shows how to interface with SymPy by using a text-based
> interface? What I need is to be able to have a sort of command-line
> interface from C++, so that I have a function for sending a string to SymPy,
> and then get the SymPy result as either another string or a floating point
> number (if the result was a number). Of course I'd need that this interface
> keeps the SymPy session alive (so that variables/symbols created in previous
> commands are still alive).
>
> I know Python has a C API, but, I'm guessing somebody must have needed this
> kind of SymPy interface from C++/C in the past, so reusing a well-tested
> C-based command-line interface would seem to be wiser than writing it from
> scratch.
I would call SymPy just like any other Python code. You can use Cython
to do that. It's a bit pain, but doable.
What is your application? SymEngine can probably almost do what you
need, we are happy to implement the missing features.
Ondrej
>
> Thanks a lot in advance!
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "symengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
symengine+...@googlegroups.com.
> To post to this group, send email to
syme...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/symengine/41555a54-0e5a-4e1c-b2b5-07c24d444c00%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.