On Thu, Dec 4, 2014 at 10:25 AM, Paul Royik <distantjob...@gmail.com> wrote:
> I know this way, but is there any way to change  this after symbol creation?

The right way in my opinion is to just create a symbol with no
assumptions and then use refine(). As I wrote below, it doesn't yet
work for this case, but it will in the future. If you have time, we
would appreciate any help with this.

Ondrej

>
> On Thursday, December 4, 2014 6:29:27 PM UTC+2, Ondřej Čertík wrote:
>>
>> On Thu, Dec 4, 2014 at 7:38 AM, Paul Royik <distan...@gmail.com> wrote:
>> > Suppose that I have an expression
>> >
>> > e = x**2+sqrt(a**2*b**2)
>> > What is the best way to assign to expression assumption that all
>> > variables
>> > are Positive, so that equivalent of e is x**2+ab?
>>
>> It should be done like this:
>>
>> In [11]: refine(e, Q.positive(a) & Q.positive(b))
>> Out[11]:
>>         _______
>>  2     ╱  2  2
>> x  + ╲╱  a ⋅b
>>
>>
>> But unfortunately that doesn't work. So the only other way is the old
>> way like this:
>>
>> In [12]: a = Symbol("a", positive=True)
>>
>> In [13]: b = Symbol("b", positive=True)
>>
>> In [14]: x**2+sqrt(a**2*b**2)
>> Out[14]:
>>        2
>> a⋅b + x
>>
>>
>> Ondrej
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/0057f9b0-377e-4409-aee8-d8284e1e0f06%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVAHer1goUWwf3o5Hwh6N6kC1V4yrLFTxmW3GFh6_i2VTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to