2011/3/3 Alexey U. Gudchenko <[email protected]>: > 03.03.2011 02:09, Aaron S. Meurer пишет: >> >> On Mar 2, 2011, at 1:27 PM, Alexey U. Gudchenko wrote: >> >>> 01.03.2011 00:34, Vinzent Steinberg пишет: >>>>> >>>>> A. My fears that it will be hard to maintain behavior of O((x-x0)**n) >>>>>> >>>>>> for pure "asymptotic expansions" expression in general case (without >>>>>> knowledge of series structure). In this case O((x-x0)**n) must detect >>>>>> and catch (x-x0)**k terms in a whole expression for every operation. >>>>>> And >>>>>> detect and do not permit operations between expressions which contain >>>>>> O((x-x1)**n) and O((x-x2)**n) respectively (x1<> x2). >>>> >>>> It would be a "for-the-moment" fix which is likely to be changed (and >>>> should be marked as such). I think it is still better than no O() term >>>> at all. >>>> >>>>>> B. I realize only maintaining of O behavior "asymptotic expansions" >>>>>> with >>>>>> knowing series structure ( 2) in [1] ) >>>>>> >>>>>> Nevertheless, I observe consensus that A*or* B must be implemented >>>>>> obligatory. >>>>>> And what is more, both A*and* B implementations better. >>>> >>>> Could you please explain what you mean with the last sentence? >>>> >>>> Vinzent >>>> >>> >>> Well, It will be easer to explain from the point of view of programmer. >>> >>> It is clear that "A" is sympy Add class which consists of polynomials >>> terms "a_n (x-x0)**n" and O((x-x0)**n). >>> >>> In "B" is imagined class TaylorExpansion that implement the "n-th order >>> Taylor expansion" so it track his precision (n), the list of [a_n], variable >>> x, and point x0. >>> [a_n] may by any sympy expression, not necessarily numbers. >>> >>> It has self-depended method for representation it in sympy (print) to >>> print "a0 + a1*(x - x0) + ... + O(x - x0)" >>> >>> It has method "asExpr()" to shape "A" variant for general propose. >>> >>> It has method "truncate" to form Taylor polynomial. May be another class >>> too if it has not analog in polynomials module yet. >>> >>> The reason of this class - that manipulations with its objects will be >>> easer. >>> >>> F.e. the derivative of it will bring to the same object but the list of >>> [a_n] will be shifted throu its index by one and precision will be >>> decremented. >>> >>> Summation equivalent to summation of lists (c_i = a_i + b_i), with >>> alignment of precision to minimal value of both. >>> >>> Multiplication will be a little complex, but still without analyzing >>> (x-x0)**k parts of expression. >>> >>> May be I became entangled now it with similar "exponential generating >>> function", but the last one is not derived from function (opposite to >>> Taylor), and it is not expansion (it is series). >>> >>> -- >>> Alexey U. >> >> It sounds like a special TaylorExpansion class should be implemented as a >> wrapper around Poly. >> >> Aaron Meurer >> > > It is not now clear for me what the class's hierarchy must be right now, Its > preliminary rough ideas, based in particular what I have seen in Wolfram > Mathematica or in thread in sympy-maillist, or upon common sense. > > Right now I learn closely the documentation of Wolfram Mathimatica for > further construction of the sympy wiki page about series and function > expansion, many things are good and I hope will be in sympy in future, some > nitpicks are present too. > > Return to Poly... > > Polynomials as I know concentrated on the tasks that is special for them: > finding roots, factorization, orthogonal and so on... Not only for effective > binary operations with them. Many of them (generally saying) are out of > sense for asymptotic expansions (when expression consist of O()). > > Also, If someone wants to use the code of Polys then it is better to obtain > "Taylor polynomial" throu some method (I have mentioned it in previously > message). It wold be clear both for user and sympy what context he is mean. > > Also, I don't know exactly right now, whether TaylorExpansion or > TaylorSerias must be know something about source function (from which this > object is derived) for some future tasks connected with convergence and so > on. And finite Polys don't know anything about convergence. > > So I have doubts for TaylorExpansion to be inherited from Polys. > > Nevertheless all this is roughly now. > After formulation from every quarter what we must expect mathematically and > from sympy (I work with this though not quickly), only then we can be able > saying about concrete implementation. > > > -- > Alexey U. >
Just to be clear, I don't necessarily think that it should subclass from Poly. I just think that the series structure should internally use a Poly, because otherwise we will end up reimplementing the basic arithmetics, like multiplication, etc. Also, Poly is very fast (much faster than an Expr object). Of course, the object should also contain other information, like the original function and the O() term, so it may make more sense to make the Poly just an attribute of the object. rather than making the object derive from Poly (I really don't know which would be better; you can think about that). Aaron Meurer -- 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.
