Hi,

On 12 August 2011 04:51, Tomo Lazovich <[email protected]> wrote:

> Hi sympy-folk,
>
> If I want to sympify some strings to get symbols from them, but I'd also
> like to have assumptions along with those symbols (in this case, that they
> are real). Is it possible to pass along assumptions to sympify like you
> could to symbols?
>

You can't pass assumptions to sympify(), but, if you know the symbols of
your problem, then you can pass a mapping with those symbols with proper
assumptions set to sympify(), e.g.:

In [1]: a, b = symbols('a,b', positive=True)

In [2]: sympify("log(a*b)").expand()
Out[2]: log(a⋅b)

In [3]: sympify("log(a*b)", {'a': a, 'b': b}).expand()
Out[3]: log(a) + log(b)


>
> Thanks!
>
> Tomo
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

Mateusz

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to