Re: [sympy] Forcing square roots to collect

2013-07-24 Thread Ben Lucato
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.

Re: [sympy] Forcing square roots to collect

2013-07-24 Thread Aaron Meurer
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

[sympy] Forcing square roots to collect

2013-07-22 Thread Ben Lucato
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

Re: [sympy] Forcing square roots to collect

2013-07-22 Thread Aaron Meurer
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