Hi, On 17 jan, 16:51, Francois Maltey <fmal...@nerim.fr> wrote: > Hello Jean-Pierre,> It would be nice to add an option to set Maxima simpsum > option when > > calling Sage symbolic_sum function, or to enable it by default. > > Indeed, without it Maxima (and so Sage) does not evaluate symbolic > > sums of sums, i.e. something as > > sage: var('n') > > n > > sage: sum(2^x+2^-x,x,0,n) > > sum((2^(2*x) + 1)/2^x, x, 0, n) > > It's a fine idea to improve the Maxima interface to Sage. > > I feel your purpose comes into simplify, combine, expand or rewrite rules. > Kind of, my main problem here is I thought that it is strange that such a sum does get simplified. > I use a rewrite function with many parameters for others rewrite rules. > A global method rewrite over expression would be better but force to > patch Sage code. > > http://wiki.sagemath.org/symbolics/rewrite > > Very few functions with an optional parameter seems better than a lot of > functions simplify_by_way as maxima. > Your awful maxima command seems be an expand rules : Unfortunately my command is not so awful. The code for symbolic code is just as horrible (look in sage/calculus/calculus.py): sum = "'sum(%s, %s, %s, %s)" % tuple([repr(expr._maxima_()) for expr in (expression, v, a, b)]) try: result = maxima.simplify_sum(sum) result = result.ratsimp() return expression.parent()(result) so it also call atsimp(). My point was, even if I was not clear at all, that it could be a not so bad idea to add 'simpsum' option because it allows Maxima to simplify such sums and anyway we already call simplify_sum() and ratsimp(). Maybe a better way to go, is not to call any of those ant let the user decide, but here the job is kind of half done. > > sum (2^x, x, 0, n) and sum (2^-x, x, 0, n) are right. > _add_ (sum (each term)) is right but sum (of_an_add...) fails. > > We can also see a simplify rule. > But I dislike this simplify name because the word "simplify" doesn't > describe a method. > > I vote to discover in a next version a generic method for this sum as : > > sum(2^x+2^-x, x, 0, n).expand(rules="sum") . > > There was also the #7334 patch for log. > The rule log(x) + log(y) -> log(x*y) is a combine rule with less atomic > terms. > And the rue log(x*y) =maybe= log(x) + log(y) is an expand one, as your sum. > > Have a nice day ! > > Francois Anyway, Sage should do all this kind of things by itself at some point, look at http://groups.google.com/group/sage-support/msg/7323dfc3db4883c8 and http://wiki.sagemath.org/symbolics.
Cheers, JP -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org