Dear Nils, dear list,
Le mercredi 28 décembre 2016 20:59:50 UTC+1, Nils Bruin a écrit :
>
> On Wednesday, December 28, 2016 at 6:18:28 AM UTC-8, Emmanuel Charpentier
> wrote:
>>
>> I d not understand what is possible and not possible about sums with Sage
>> (and its minions).
>>
>> I am interested in the symbolic manipulation of a sum of (unspecified)
>> data series X. Since Sage does nott (yet) admits indiced symbolic variable,
>> it is reprsented by a function of an integer argument.
>>
>> Sage seems unable to show that
>> $\sum_{i=1}^{p+1}X_i-\sum_{i=1}^pX_i==X_{p+1}$ :
>>
>> sage: var("p,j", domain="integer")
>> ....: assume(p,"integer",j,"integer",p>0)
>> ....: X=function("X")(j)
>>
>
> You can avoid the warning downstairs by simply setting X=function("X") or
> (because of the side-effects of toplevel function, just function("X") .
>
>> ....: foo(p)=sum(X(j),j,1,p)
>>
>
> This has the nasty sideeffect of clobbering "p" (which in your case
> doesn't make any difference, I think). Calling
>
> foo = sum(x(j),j,1,p).function(p)
>
A nice one ! I didn't think of it.
>
> has a cleaner result.
>
>
> ....: print foo
>> ....: bool(foo(p+1)-foo(p)==X(p+1))
>> ....:
>> (p, j)
>> /usr/local/sage-7/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2881:
>>
>> DeprecationWarning: Substitution using function-call syntax and unnamed
>> arguments is deprecated and will be removed from a future release of Sage;
>> you can use named arguments instead, like EXPR(x=..., y=...)
>> See http://trac.sagemath.org/5930 for details.
>> exec(code_obj, self.user_global_ns, self.user_ns)
>> p |--> sum(X(j), j, 1, p)
>> False
>>
>> I understand the warning, and think it's irrelevant. But I do not
>> understand why the "obvious" expansion is not used. Similarly :
>> sage: (foo(p+1)-foo(p)).maxima_methods().sumcontract()
>> sum(X(j), j, 1, p + 1) - sum(X(j), j, 1, p)
>>
>> Am I missing something ?
>>
>
> It seems to me that this is an unnecessary limitation in the maxima
> routines. It clearly knows something about sum manipulations. Perhaps it's
> worth reporting to the Maxima tracker. I'm not so sure this will ever be
> very powerful, though, but the following example shows that some
> improvements should be within reach:
>
> sage: T=foo(p+1)+foo(p)
> sage: T.maxima_methods().sumcontract()
> X(p + 1) + 2*sum(X(j), j, 1, p)
>
> It does agree with the documentation of sumcontract, which deals with
> addition of sums. Apparently, that does not include differences of sums ...
>
This is now Maxima's bug 3267 <https://sourceforge.net/p/maxima/bugs/3267/>.
Do you think that a Sage-specific ticket would be usefuil ?
HTH,
--
Emmanuel Charpentier
>
>
>> --
>> Emmanuel Charpentier
>>
>>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.