Le vendredi 25 février 2011 à 23:55 +0545, Chris Smith a écrit : > Ronan Lamy wrote: > >> Why f.e. this variant: > >> > >> > h[2]>>> cos(x).series(x,1,n=2) > >> > (1 - x)*sin(1) + cos(1) + O((x - 1)**2) > >> > >> is bad ? > > > > What's bad is that '(x - 1)' in the O() is actually a symbol that's > > completely unrelated to x. This could be very confusing and it's > > unlikely that such an expression will be handled correctly by existing > > functions. > > What's good is that only the user that reads the docstring is going > to be able to figure out how to do this. Anyone else is going to just > get the shifted function result. The commit message is also clear > about what's happening: > > 2) if sudo=True then return the expression with a non-functional > but proper looking O() term. Symbol trickery is used here to > replace x with Symbol(str(x-x0)) in the O() term.
I don't see the point of this, actually. The expression is only good for printing, but users who know what they're doing can easily get a "nice" expression with, for instance, expr.series(x, 1, n=2).subs(x, Symbol(str(x-1))). On the other hand, every new option doubles the amount of testing we should do and increases the cognitive burden on the user. > > I agree that O() needs to be fixed to take an x0 argument before we > > can represent expansions at a point other than 0. Correct handling of all > > cases (x0 = oo, O(1, x, x0=0) + O(1, x, x0=1), ...) can probably wait. > > Are you ok with proceeding, then? If not, could you clearly tell what it > would > take to get a positive vote? Remove the 'sudo' option. Everything else looks good to me - though I'm sure that given enough time, I could still find a few reason to nitpick. -- 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.
