Actually, I don't understand the merits. Why do we do it? Your case
gives a clear instance where it would not be desired. Doing so
manually would not be hard (just expand_log).

Aaron Meurer

On Thu, May 2, 2013 at 10:04 PM, Ben Lucato <ben.luc...@gmail.com> wrote:
> That's fine - I understand the merits of pulling out the powers. I'm just
> looking to be able to rewrite things like 2 * log(2) as log(4) when I so
> desire. Thanks for your suggestions and I will play around with them!
>
> On Friday, 3 May 2013 13:40:29 UTC+10, Aaron Meurer wrote:
>>
>> Unfortunately, log automatically pulls out powers like this. If you
>> want, we could certainly discuss the merits of not having it do this.
>>
>> As a workaround, you can use log(4, evaluate=False). I think you could
>> also subclass log and give it a custom eval that doesn't do that.
>>
>> Something like this seems to work
>>
>> class mylog(log):
>>     @classmethod
>>     def eval(self, *args):
>>         if args[0].is_Number:
>>             return None
>>         return super(mylog, self).eval(*args)
>>
>> Aaron Meurer
>>
>> On Thu, May 2, 2013 at 9:25 PM, Ben Lucato <ben.l...@gmail.com> wrote:
>> > Not sure how to get this behavior in sympy - or even if it's possible.
>> > It
>> > doesn't just go for this particular example, I want to be able to do it
>> > for
>> > all such logs.
>> >
>> >
>> > Many thanks!!! Sympy rocks
>> >
>> > --
>> > 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+un...@googlegroups.com.
>> > To post to this group, send email to sy...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>
> --
> 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?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to