id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
15346 Symbolic sums should evaluate Karl-Dieter Crisman "[http://ask.sagemath.org/question/3152 This ask.sagemath question] points out that
{{{
sage: k,n = var('k,n')
sage: f(x,k) = sum((2/n)*(sin(n*x)*(-1)^(n+1)), n, 1, k)
sage: f(x,2)
-2*sum((-1)^n*sin(n*x)/n, n, 1, 2)
}}}
while
{{{
sage: f(x)=(2/n)*(sin(n*x)*(-1)^(n+1))
sage: sum(f, n, 1, 2) #using summation function
-sin(2*x) + 2*sin(x)
}}}
User twch found this workaround
{{{
sage: var('n')
sage: def g(x,k):
sage: return sum((2/n)*(sin(n*x)*(-1)^(n+1)), n, 1, k)
sage: print g(x,2)
-sin(2*x) + 2*sin(x)
}}}
but I agree with him/her that we should look into how to fix this.
The essential problem is that when Maxima does not simplify a sum, we don't have any mechanism (currently) to get it to ""just print out all the numbers"". Which of course may not be very nice when `k` is big, but presumably should be allowed to be done by users.
----
By the way, the way to do this in Maxima is as follows:
{{{
(%i1) f: -2*'sum((-1)^n*sin(n*x)/n,n,1,2);
2
==== n
\ (- 1) sin(n x)
(%o1) - 2 > ---------------
/ n
====
n = 1
(%i8) f, nouns;
sin(2 x)
(%o8) - 2 (-------- - sin(x))
2
}}}
so setting `nouns:true` just for this would work, but I can never figure out how to do this from within Sage - see #10955.
Possibly related: #9424
See also
- http://ask.sagemath.org/question/9937/how-do-i-evaluate-sum-containing-factorial/
- http://ask.sagemath.org/question/24911/exponentiation-makes-a-formula-go-crazy/ " defect closed major sage-6.5 symbolics fixed Michael Orlitzky Ralf Stephan Karl-Dieter Crisman N/A 3ee8c6d29ce916b70e5c0f32a0ae961796344afd 3ee8c6d29ce916b70e5c0f32a0ae961796344afd