Great. It's worth taking a read of
http://docs.sympy.org/0.7.3/tutorial/simplification.html#exponentials-and-logarithms
if you are new to this function (the bit about assumptions is
particularly important to understand).

Aaron Meurer

On Wed, Jul 24, 2013 at 6:07 AM, Ben Lucato <ben.luc...@gmail.com> wrote:
> L-l-l-l-l-legend. expand_log works like a charm, with a bit of tweaking.
> Thanks a bunch!
>
>
> On Tuesday, 23 July 2013 13:01:50 UTC+10, Aaron Meurer wrote:
>>
>> Sorry, but some powers automatically denest:
>>
>> In [6]: print sqrt(x/2)
>> sqrt(2)*sqrt(x)/2
>>
>> so it is impossible to pull them together.
>>
>> expand_log does what you want, though it also expands using the
>> additive rule. It's not too much more complicated to make it work with
>> a multiplication of powers instead of a single power, though, if you
>> insist on writing your own targeted simplification function.
>>
>> Aaron Meurer
>>
>>
>> On Mon, Jul 22, 2013 at 2:28 AM, Ben Lucato <ben.l...@gmail.com> wrote:
>> > Say I have an expression like:
>> >
>> > y = sqrt(2) * sqrt(-x + 4)/2
>> >
>> > and then we call powsimp(y), we get:
>> >
>> > sqrt(-2*x + 8)/2
>> >
>> > is there a way to get
>> >
>> > sqrt((-x + 4) / 2), i.e. have the denominator of the fraction be checked
>> > too? I tried looking at the docs but there didn't seem to be a
>> > simplification for this.
>> >
>> >
>> > My reasoning is for writing logs: if I can collect everything inside a
>> > log
>> > to have a power, then that power can be moved outside the log - in this
>> > case, log(y) would become:
>> >
>> > log((-x + 4) / 2) / 2
>> >
>> > --
>> > 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.
>> > 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to