On Thu, Apr 23, 2009 at 1:17 PM, Tim Lahey <tim.la...@gmail.com> wrote: > > > On Apr 23, 2009, at 4:07 PM, William Stein wrote: > >> >> Could you explain how assumptions are so important? Could you
We already discussed this many times on this list, just search the archives. Without good assumptions, you cannot implement good integration, good solvers, good simplification, nothing. Of course, things like x+x is easy, but once you have for example Integral(<complex expression involving many constants>), sometimes you can simplify it, sometimes not and this very much depends on the assumptions for the constants. Or things like integrate(x**n, x). >> particularly address how they can (1) be so critically important, and >> yet (2) ginac doesn't have them. Incidentaly, to me they are ginac doesn't have any assumptions and so ginac doesn't have any advanced symbolic features. Of course, if the only thing that you are going to use ginac for is the core engine, then it should not matter much. But what I want from a CAS is to be able to do advanced symbolic calculations with symbols, so I need some way to tell it my assumptions about the symbols. Taking everything as complex numbers will not simplify things in many cases. >> particularly important in symbolic integration, which ginac doesn't >> do. Also, could you explain why the assumption system in Sympy >> needs to be rewritten -- in particular, what design decisions were >> suboptimal? Because we attach assumptions to symbols, e.g. you define In [2]: x = Symbol("x", positive=True) and then you work with that: In [3]: sqrt(x**2) Out[3]: x In [4]: x = Symbol("x", negative=True) In [5]: sqrt(x**2) Out[5]: -x In [6]: x = Symbol("x") In [7]: sqrt(x**2) Out[7]: ⎽⎽⎽⎽ ╱ 2 ╲╱ x But this approach is the wrong one, because then the core engine has to take this into account and it slows things down. Our new system will keep the assumptions external, and define methods to work with them, like in mathematica, e.g. refine(). This should simplify the core and then we should be able to speed it up. >> >> -- William >> > > One place where I use assumptions regularly is with trig functions. If > you have sin(n*pi) or cos(n*pi), stating the assumption that n is > integer > reduces the first to 0 and the second to alternating +1,-1. These crop > up > in modal analysis of physical systems regularly. I don't know > if sympy's assumptions are suboptimal, since I haven't used sympy much, > but I guess it is since they're planning on improvements. Exactly, all kinds of these assumptions, that are necessary for integration, simplifications, e.g. sometimes sqrt(x**2) reduces to x, sometimes to -x, sometimes to neither. Ondrej --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---