On Thu, Oct 21, 2010 at 1:43 PM, Mateusz Paprocki <[email protected]> wrote:
> Hi,
>
> On Thu, Oct 21, 2010 at 02:26:18PM -0600, Aaron S. Meurer wrote:
>> Whenever I worked on this a long time ago, I discovered that there is no one 
>> ordering that will work for all expressions (see the docstring of expand()). 
>>  At that point in time, I was already digressing from my GSoC project for 
>> some time to work on it, so I decided to just make it the way it is now.
>>
>> I agree that it needs to be smarter.  Maybe, if we move out the polynomial 
>> type expansion into having Poly to do the work, then the other hints (log, 
>> exp_base/power, trig, complex) will not conflict so much.
>>
>
>> On the other hand, in some cases, it really could be considered ambiguous 
>> what "expand" means.  For example, if you have log((x + 1)*(x - 1)), is the 
>> expanded form log(x + 1) + log(x - 1) or log(x**2 - 1).  expand() right now 
>> will return either, depending on what order the hints are processed in.  
>> Perhaps really the best thing to do is to always try to use the specific 
>> expand functions (expand_log, expand_mul, etc.) in the code, based on what 
>> the expansion need is (Chris's hint manager should help with this). I think 
>> that the majority of the time, the polynomial type expansion is all that the 
>> algorithm really wants, because it wants to make sure that the expression is 
>> an Add if it can be.
>>
>
> There is a good reason why e.g. Mathematica's Expand[] does only
> polynomial expansion (over various domains) and there are other
> functions for performing other types of expansion. When I first
> added those `hints' to expand() I meant:
>
>  expand(expr, something=True) -> something_expand(expr)
>
> but it went completely different direction to become something
> I dislike in mathematical systems. I would like our expand()
> does poly()'s job and nothing more and there should be other
> *_expand() functions for particular tasks (they may use other
> expansion functions, but the order of application of rewrite
> functions must be deterministic and well defined).

I totally agree with this.

Ondrej

-- 
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