Getting STL container of variables in SymEngine::Expression

28 views
Skip to first unread message

Panagiotis Stavropoulos

unread,
May 26, 2020, 4:37:14 PM5/26/20
to symengine
Hello,

I am working in C++. I am trying to get (any) STL container of the variables of a SymEngine::Expression. Lets say for a silly example somewhere in main I have:

SymEngine::Expression ex = SymEngine::Expression("5*x+sqrt(5/4)+1/(y-8)");

I cannot figure out what function to call to get the the variables x and y out of the ex and store them in a container. Any help is appriciated.

Isuru Fernando

unread,
May 26, 2020, 4:47:21 PM5/26/20
to symengine
It'll give you a,  std::set<RCP<const Basic>> and you can convert it into any form you like.

Isuru

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/symengine/c0122e6c-67be-4948-ab56-dbab55237e70%40googlegroups.com.

Peter

unread,
May 26, 2020, 5:06:47 PM5/26/20
to symengine
Excellent, thank you very much!


On Tuesday, 26 May 2020 16:47:21 UTC-4, Isuru Fernando wrote:
It'll give you a,  std::set<RCP<const Basic>> and you can convert it into any form you like.

Isuru

On Tue, May 26, 2020 at 3:37 PM Panagiotis Stavropoulos <peter...@gmail.com> wrote:
Hello,

I am working in C++. I am trying to get (any) STL container of the variables of a SymEngine::Expression. Lets say for a silly example somewhere in main I have:

SymEngine::Expression ex = SymEngine::Expression("5*x+sqrt(5/4)+1/(y-8)");

I cannot figure out what function to call to get the the variables x and y out of the ex and store them in a container. Any help is appriciated.

--
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 syme...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages