Sage: Ticket #15346: Symbolic sums should evaluate
https://trac.sagemath.org/ticket/15346
<p>
<a class="ext-link" href="http://ask.sagemath.org/question/3152"><span class="icon"></span>This ask.sagemath question</a> points out that
</p>
<pre class="wiki">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)
</pre><p>
while
</p>
<pre class="wiki">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)
</pre><p>
User twch found this workaround
</p>
<pre class="wiki">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)
</pre><p>
but I agree with him/her that we should look into how to fix this.
</p>
<p>
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 <code>k</code> is big, but presumably should be allowed to be done by users.
</p>
<hr />
<p>
By the way, the way to do this in Maxima is as follows:
</p>
<pre class="wiki">
(%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
</pre><p>
so setting <code>nouns:true</code> just for this would work, but I can never figure out how to do this from within Sage - see <a class="closed ticket" href="https://trac.sagemath.org/ticket/10955" title="#10955: task: Get Maxima to easily accept flag values (closed: fixed)">#10955</a>.
</p>
<p>
Possibly related: <a class="closed ticket" href="https://trac.sagemath.org/ticket/9424" title="#9424: defect: Provide symbolic sum function with evalf (closed: fixed)">#9424</a>
</p>
<p>
See also
</p>
<ul><li><a class="ext-link" href="http://ask.sagemath.org/question/9937/how-do-i-evaluate-sum-containing-factorial/"><span class="icon"></span>http://ask.sagemath.org/question/9937/how-do-i-evaluate-sum-containing-factorial/</a>
</li><li><a class="ext-link" href="http://ask.sagemath.org/question/24911/exponentiation-makes-a-formula-go-crazy/"><span class="icon"></span>http://ask.sagemath.org/question/24911/exponentiation-makes-a-formula-go-crazy/</a>
</li></ul>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/15346
Trac 1.2For batch modificationsThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/15346#comment:1
https://trac.sagemath.org/ticket/15346#comment:1
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
TicketFor batch modificationsTue, 06 May 2014 15:20:58 GMTmilestone changed
https://trac.sagemath.org/ticket/15346#comment:2
https://trac.sagemath.org/ticket/15346#comment:2
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
TicketFor batch modificationsSun, 10 Aug 2014 16:51:03 GMTmilestone changed
https://trac.sagemath.org/ticket/15346#comment:3
https://trac.sagemath.org/ticket/15346#comment:3
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.3</em> to <em>sage-6.4</em>
</li>
</ul>
TicketJeroen DemeyerTue, 02 Dec 2014 08:49:06 GMTpriority, description, summary changed
https://trac.sagemath.org/ticket/15346#comment:4
https://trac.sagemath.org/ticket/15346#comment:4
<ul>
<li><strong>priority</strong>
changed from <em>minor</em> to <em>major</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/15346?action=diff&version=4">diff</a>)
</li>
<li><strong>summary</strong>
changed from <em>symbolic sums that don't simplify don't simplify</em> to <em>Symbolic sums should evaluate</em>
</li>
</ul>
TicketRalf StephanTue, 02 Dec 2014 09:57:14 GMTbranch set
https://trac.sagemath.org/ticket/15346#comment:5
https://trac.sagemath.org/ticket/15346#comment:5
<ul>
<li><strong>branch</strong>
set to <em>u/rws/symbolic_sums_should_evaluate</em>
</li>
</ul>
TicketRalf StephanTue, 02 Dec 2014 09:58:00 GMTstatus changed; commit, author set
https://trac.sagemath.org/ticket/15346#comment:6
https://trac.sagemath.org/ticket/15346#comment:6
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
set to <em>df516f88d0c13d22d60e8b7d191eb0b2aa75f26a</em>
</li>
<li><strong>author</strong>
set to <em>Ralf Stephan</em>
</li>
</ul>
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=df516f88d0c13d22d60e8b7d191eb0b2aa75f26a"><span class="icon"></span>df516f8</a></td><td><code>15346: implement simplify_sum and call it from full_simplify</code>
</td></tr></table>
TicketRalf StephanTue, 02 Dec 2014 10:02:05 GMT
https://trac.sagemath.org/ticket/15346#comment:7
https://trac.sagemath.org/ticket/15346#comment:7
<p>
The issue however begs the question if it should not be possible to give hold parameter to sums.
</p>
TicketKarl-Dieter CrismanTue, 02 Dec 2014 13:50:47 GMT
https://trac.sagemath.org/ticket/15346#comment:8
https://trac.sagemath.org/ticket/15346#comment:8
<p>
Don't have time to review this immediately (though I think the <code>hold</code> would be a separate ticket, though an important one) but am wondering whether a couple of the more complex sums mentioned here and in the ask.sagemath questions should be included as tests.
</p>
TicketgitThu, 04 Dec 2014 07:16:10 GMTcommit changed
https://trac.sagemath.org/ticket/15346#comment:9
https://trac.sagemath.org/ticket/15346#comment:9
<ul>
<li><strong>commit</strong>
changed from <em>df516f88d0c13d22d60e8b7d191eb0b2aa75f26a</em> to <em>af565761f5a154fc1745bc754c3cbbb642065baf</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=af565761f5a154fc1745bc754c3cbbb642065baf"><span class="icon"></span>af56576</a></td><td><code>15346: add doctest</code>
</td></tr></table>
TicketgitSun, 01 Feb 2015 16:57:53 GMTcommit changed
https://trac.sagemath.org/ticket/15346#comment:10
https://trac.sagemath.org/ticket/15346#comment:10
<ul>
<li><strong>commit</strong>
changed from <em>af565761f5a154fc1745bc754c3cbbb642065baf</em> to <em>37f26afb68fdf136b9568db127395f6115d22a92</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=37f26afb68fdf136b9568db127395f6115d22a92"><span class="icon"></span>37f26af</a></td><td><code>Merge branch 'develop' into t/15346/symbolic_sums_should_evaluate</code>
</td></tr></table>
TicketKarl-Dieter CrismanTue, 03 Feb 2015 02:57:53 GMT
https://trac.sagemath.org/ticket/15346#comment:11
https://trac.sagemath.org/ticket/15346#comment:11
<p>
You're going to get annoyed by this question, but I do feel it's a UI issue. Is <code>simplify_sum</code> the right name for this? I'm just wondering; it isn't exactly a "simplification". Though <code>evaluate_sum</code> doesn't exactly get me excited either. What do you think? Also, I'm not 100% sure it should be in <code>simplify_full</code> - a very long one of these might feel more complicated than "just the sum".
</p>
TicketRalf StephanTue, 03 Feb 2015 09:25:52 GMT
https://trac.sagemath.org/ticket/15346#comment:12
https://trac.sagemath.org/ticket/15346#comment:12
<p>
I'm not so sure about UI issues here and elsewhere, either. I'm much in favor of those tickets proposing functions with keywords handling this, like <code>rewrite</code> or <code>expand(rules="sum")</code>. Please see <a class="wiki" href="https://trac.sagemath.org/wiki/symbolics#simplifyexpandsubstituteandrelationequalitytickets">wiki:symbolics#simplifyexpandsubstituteandrelationequalitytickets</a> for these.
</p>
<p>
If we stick to <code>expand</code> and <code>rewrite</code>, what about <code>expand_sum</code>?
</p>
TicketKarl-Dieter CrismanTue, 03 Feb 2015 14:04:03 GMT
https://trac.sagemath.org/ticket/15346#comment:13
https://trac.sagemath.org/ticket/15346#comment:13
<p>
I like <code>expand_sum</code>, and it would presumably work with <code>hold=True</code> later as well.
</p>
<blockquote class="citation">
<p>
I'm much in favor of those tickets proposing functions with keywords handling this,
</p>
</blockquote>
<p>
In retrospect that would have been a good design discussion to have had. Though I should say that with tab-completion, I like the current system better. Maxima has all these flags and such, and you have to <em>know</em> about them. Your time is better spent adding the functionality you are - and I know it isn't getting reviewed very quickly, but experience says that they <strong>will</strong> get reviewed! A number of the people who were pretty involved in symbolics have different jobs or school now, so they haven't been able to be as involved. (I would have liked Burcin's input on this naming scheme, for instance, so it's not just two people.) Pros and cons of open source development...
</p>
TicketRalf StephanTue, 03 Feb 2015 17:29:48 GMTbranch changed
https://trac.sagemath.org/ticket/15346#comment:14
https://trac.sagemath.org/ticket/15346#comment:14
<ul>
<li><strong>branch</strong>
changed from <em>u/rws/symbolic_sums_should_evaluate</em> to <em>u/rws/15346</em>
</li>
</ul>
TicketRalf StephanTue, 03 Feb 2015 17:31:00 GMTcommit changed
https://trac.sagemath.org/ticket/15346#comment:15
https://trac.sagemath.org/ticket/15346#comment:15
<ul>
<li><strong>commit</strong>
changed from <em>37f26afb68fdf136b9568db127395f6115d22a92</em> to <em>17dda26e29b6f381ee8eab545923a55e3bc9b4e6</em>
</li>
</ul>
<p>
Please review.
</p>
<hr />
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=17dda26e29b6f381ee8eab545923a55e3bc9b4e6"><span class="icon"></span>17dda26</a></td><td><code>15346: make maxima.simplify_sum available as expand_sum</code>
</td></tr></table>
TicketKarl-Dieter CrismanTue, 03 Feb 2015 18:01:09 GMT
https://trac.sagemath.org/ticket/15346#comment:16
https://trac.sagemath.org/ticket/15346#comment:16
<pre class="wiki"> Apply ``simplify_factorial``, ``simplify_trig``,
``simplify_rational``, ``simplify_log``, again
``simplify_rational``, and then ``expand_sum``
to self (in that order).
</pre><p>
but
</p>
<pre class="wiki"> x = self
x = x.simplify_factorial()
x = x.simplify_rectform()
x = x.simplify_trig()
x = x.simplify_rational()
x = x.simplify_log('one')
x = x.simplify_rational()
x = x.expand_sum()
return x
</pre>
TicketgitWed, 04 Feb 2015 09:46:54 GMTcommit changed
https://trac.sagemath.org/ticket/15346#comment:17
https://trac.sagemath.org/ticket/15346#comment:17
<ul>
<li><strong>commit</strong>
changed from <em>17dda26e29b6f381ee8eab545923a55e3bc9b4e6</em> to <em>cb78603878bc1a7443e982824e13c81e22e9edda</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=cb78603878bc1a7443e982824e13c81e22e9edda"><span class="icon"></span>cb78603</a></td><td><code>15346: cosmetics</code>
</td></tr></table>
TicketKarl-Dieter CrismanWed, 04 Feb 2015 21:48:39 GMTcc, reviewer set
https://trac.sagemath.org/ticket/15346#comment:18
https://trac.sagemath.org/ticket/15346#comment:18
<ul>
<li><strong>cc</strong>
<em>Michael Orlitzky</em> added
</li>
<li><strong>reviewer</strong>
set to <em>Karl-Dieter Crisman</em>
</li>
</ul>
<p>
As I suspected, the addition of the log thing led to some issues. Is this 'simplification' always valid for complex numbers? I know mjo has been very good at thinking about this kind of thing, cc:ing him.
</p>
<pre class="wiki">
File "src/sage/symbolic/expression.pyx", line 8249, in sage.symbolic.expression.Expression.simplify_full
Failed example:
f.simplify_full()
Expected:
log(x*y) - log(x) - log(y)
Got:
0
**********************************************************************
File "src/sage/modules/vector_symbolic_dense.py", line 19, in sage.modules.vector_symbolic_dense
Failed example:
u.simplify_full()
Expected:
(1, log(3*y) + log(2*y))
Got:
(1, log(6*y^2))
**********************************************************************
</pre><p>
Naturally, this is orthogonal to the main issue, but I think it should be in a different ticket unless it's very obvious it's okay.
</p>
<p>
As to the main question, I think my only question is whether this should definitely be incorporated in <code>simplify_full</code>. Can anyone think of a reason <em>not</em> to do so? I'm straining my brain to be creative here - for instance, if it should make a really really really long expression which isn't "simpler"? I can't find it but there was some Maxima comment about the massive length of some such expressions. My druthers would be to keep this separate from <code>simplify_full</code> for now, though I understand the reasons <em>for</em> doing it!
</p>
TicketMichael OrlitzkyWed, 04 Feb 2015 22:51:36 GMT
https://trac.sagemath.org/ticket/15346#comment:19
https://trac.sagemath.org/ticket/15346#comment:19
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/15346#comment:18" title="Comment 18">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
As I suspected, the addition of the log thing led to some issues.
</p>
</blockquote>
<p>
This is just a conflict from having two branches modify <code>simplify_full</code> at the same time. You can rebase this one on top of "develop" now and I think it'll be fine. To avoid conflicts, I would,
</p>
<ul><li>Copy/paste the <code>expand_sum</code> method somewhere
</li><li>reset --hard your branch to match "develop"
</li><li>Add back the <code>expand_sum</code> method
</li><li>Update <code>simplify_full</code> and its docstring
</li><li>Recommit
</li></ul><p>
I'm sure there's a smarter way to do the copy/paste step, but it works.
</p>
<blockquote class="citation">
<p>
Is this 'simplification' always valid for complex numbers? I know mjo has been very good at thinking about this kind of thing, cc:ing him.
</p>
</blockquote>
<p>
In the examples, <code>n</code> and <code>k</code> are complex, and it doesn't make any sense to sum from, say, zero a complex number. But if anything, the bug there is that <code>sum()</code> allows you to give it non-integer limits.
</p>
<p>
The Maxima docs aren't too clear about what <code>simplify_sum</code> does, so it's hard to say whether or not it's safe when the summand contains complex variables. We can try it and see what happens. Since it's hidden beneath <code>simplify_full</code> we could always go back and remove it if it causes problems.
</p>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 02:15:44 GMT
https://trac.sagemath.org/ticket/15346#comment:20
https://trac.sagemath.org/ticket/15346#comment:20
<blockquote class="citation">
<blockquote class="citation">
<p>
Is this 'simplification' always valid for complex numbers? I know mjo has been very good at thinking about this kind of thing, cc:ing him.
</p>
</blockquote>
</blockquote>
<p>
Sorry, I meant the log bit. Wait, was that already in develop? I merged develop into this branch locally, should have been up-to-date.
</p>
<p>
I'm not worried about the summation with complex variables, for the record, just trying to brainstorm.
</p>
TicketMichael OrlitzkyThu, 05 Feb 2015 02:35:18 GMT
https://trac.sagemath.org/ticket/15346#comment:21
https://trac.sagemath.org/ticket/15346#comment:21
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/15346#comment:20" title="Comment 20">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
Sorry, I meant the log bit. Wait, was that already in develop? I merged develop into this branch locally, should have been up-to-date.
</p>
</blockquote>
<p>
Yikes, I guess not. I opened ticket <a class="closed ticket" href="https://trac.sagemath.org/ticket/17731" title="#17731: defect: Fix git mixup from ticket #17556 (closed: invalid)">#17731</a>.
</p>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 02:37:01 GMTdependencies set
https://trac.sagemath.org/ticket/15346#comment:22
https://trac.sagemath.org/ticket/15346#comment:22
<ul>
<li><strong>dependencies</strong>
set to <em>#17731</em>
</li>
</ul>
<p>
Okay, so let's make that a dependency for this so that rws can rebase to that. Sorry, Ralf, that's not your fault - good thing I ran all the tests! And I <em>thought</em> I had recalled removing that simplification from <code>simplify_full</code>.
</p>
TicketMichael OrlitzkyThu, 05 Feb 2015 02:48:09 GMT
https://trac.sagemath.org/ticket/15346#comment:23
https://trac.sagemath.org/ticket/15346#comment:23
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/15346#comment:22" title="Comment 22">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
Okay, so let's make that a dependency for this so that rws can rebase to that. Sorry, Ralf, that's not your fault - good thing I ran all the tests! And I <em>thought</em> I had recalled removing that simplification from <code>simplify_full</code>.
</p>
</blockquote>
<p>
I get more confused the more I look at this. Ralf's branch in ticket <a class="closed ticket" href="https://trac.sagemath.org/ticket/17556" title="#17556: enhancement: Move simplify_log() from simplify_full() to simplify_real() (closed: fixed)">#17556</a> had mine as a parent, so my commits should have gone in along with his. After switching my branches around a few times, I see them now in develop.
</p>
<p>
If you <code>git checkout develop</code> and then <code>git pull</code>, do you see them there? (You can do <code>git log</code> then hit forward-slash to search.) If they were there to begin with, there should have been a merge conflict with this branch. But those two simplify doctests shouldn't be failing unless you wound up with a chimera.
</p>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 03:06:24 GMT
https://trac.sagemath.org/ticket/15346#comment:24
https://trac.sagemath.org/ticket/15346#comment:24
<blockquote class="citation">
<p>
If you git checkout develop and then git pull, do you see them there?
</p>
</blockquote>
<p>
Yes. Though I usually pull from trac not origin. But in any case the branch I was working with for this ticket also has that already in it. Yet on that branch I get
</p>
<pre class="wiki">sage: z = log(3*x)+log(2*x)
sage: z.simplify_full()
log(6*x^2)
</pre><p>
I don't understand either. And
</p>
<pre class="wiki">$ git merge develop
Already up-to-date.
</pre><p>
as expected.
</p>
TicketMichael OrlitzkyThu, 05 Feb 2015 03:58:47 GMT
https://trac.sagemath.org/ticket/15346#comment:25
https://trac.sagemath.org/ticket/15346#comment:25
<p>
Ok, I think I see what happened. False alarm. Looking at Ralf's original commit in comment 6, he added <code>simplify_sum</code> to <code>simplify_full</code>, but that was before I removed <code>simplify_log</code> and the redundant <code>simplify_rational</code>.
</p>
<p>
In comment 10, the git bot merges with develop, pulling in the patch that removed <code>simplify_log</code> and the redundant <code>simplify_rational</code>. But then in the commit from comment 16, the <code>simplify_log</code> and <code>simplify_rational</code> are back and git thinks they're being re-added.
</p>
<p>
I'm not sure exactly where things went awry. At this point I usually throw my hands up, <code>git reset --hard</code>, and then copy/paste paste the code back where it's supposed to go. You can force-push the branch and check the link above to make sure it's not re-adding <code>simplify_log</code>.
</p>
TicketRalf StephanThu, 05 Feb 2015 07:25:28 GMT
https://trac.sagemath.org/ticket/15346#comment:26
https://trac.sagemath.org/ticket/15346#comment:26
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/15346#comment:22" title="Comment 22">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
Sorry, Ralf, that's not your fault
</p>
</blockquote>
<p>
Disagree. I remember too that at some time I removed it before doing a local commit. But in 17dda26 I seem to have added the log involuntarily nevertheless. That's why it's in this ticket branch and I'll remove it now. Then Michael seemed to assume that a different cause happened and based <a class="closed ticket" href="https://trac.sagemath.org/ticket/17731" title="#17731: defect: Fix git mixup from ticket #17556 (closed: invalid)">#17731</a> on that. So it's really me that has to apologize.
</p>
TicketgitThu, 05 Feb 2015 08:19:34 GMTcommit changed
https://trac.sagemath.org/ticket/15346#comment:27
https://trac.sagemath.org/ticket/15346#comment:27
<ul>
<li><strong>commit</strong>
changed from <em>cb78603878bc1a7443e982824e13c81e22e9edda</em> to <em>c2de94ad4765dfd62bb9c779dec9c0b387b7f949</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=c2de94ad4765dfd62bb9c779dec9c0b387b7f949"><span class="icon"></span>c2de94a</a></td><td><code>15346: sync to develop</code>
</td></tr></table>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 13:59:27 GMT
https://trac.sagemath.org/ticket/15346#comment:28
https://trac.sagemath.org/ticket/15346#comment:28
<p>
Okay, I got you on that. I'll rerun tests this morning and add my stashed example I was going to add as a reviewer patch by the end of the day.
</p>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 16:33:11 GMTdependencies deleted
https://trac.sagemath.org/ticket/15346#comment:29
https://trac.sagemath.org/ticket/15346#comment:29
<ul>
<li><strong>dependencies</strong>
<em>#17731</em> deleted
</li>
</ul>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 16:35:27 GMTcommit, branch changed
https://trac.sagemath.org/ticket/15346#comment:30
https://trac.sagemath.org/ticket/15346#comment:30
<ul>
<li><strong>commit</strong>
changed from <em>c2de94ad4765dfd62bb9c779dec9c0b387b7f949</em> to <em>3ee8c6d29ce916b70e5c0f32a0ae961796344afd</em>
</li>
<li><strong>branch</strong>
changed from <em>u/rws/15346</em> to <em>u/kcrisman/15346</em>
</li>
</ul>
<p>
Okay. So I am happy with this, modulo the question about whether this really belongs in <code>simplify_full</code> - again, just because it could make something VERY long and not at all "simple". I assume Ralf and I differ on this. Michael, would you like to be the tiebreak? I don't want to hold up this wrapping of Maxima's functionality.
</p>
<hr />
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="http://git.sagemath.org/sage.git/commit/?id=3ee8c6d29ce916b70e5c0f32a0ae961796344afd"><span class="icon"></span>3ee8c6d</a></td><td><code>Additional example</code>
</td></tr></table>
TicketMichael OrlitzkyThu, 05 Feb 2015 16:58:28 GMT
https://trac.sagemath.org/ticket/15346#comment:31
https://trac.sagemath.org/ticket/15346#comment:31
<p>
I think it's OK to have it in <code>simplify_full</code>. It's really annoying to have a sum of integers like,
</p>
<pre class="wiki">sage: f(n=8)
sum(abs(-k^2 + 8), k, 1, 8)
</pre><p>
with no way to get it down to a single number. (You can copy/paste the sum back in, but that may not be an option.) It's also a lot to ask of our users to know every method on the Expression class, but everyone knows <code>simplify_full</code>.
</p>
<p>
If it causes problems, we can remove it. Or if it makes some expressions a lot uglier, there's the hack I used in <code>simplify_rectform</code>:
</p>
<pre class="wiki">if complexity_measure(simplified_expr) < complexity_measure(self):
return simplified_expr
else:
return self
</pre><p>
I think it will be fine though.
</p>
TicketKarl-Dieter CrismanThu, 05 Feb 2015 17:00:08 GMTstatus changed
https://trac.sagemath.org/ticket/15346#comment:32
https://trac.sagemath.org/ticket/15346#comment:32
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<blockquote class="citation">
<p>
If it causes problems, we can remove it.
</p>
</blockquote>
<p>
Somewhat of an API change, of course. My guess is it won't come up often enough, but anyway thanks for the input!
</p>
TicketRalf StephanFri, 06 Feb 2015 16:18:16 GMTmilestone changed
https://trac.sagemath.org/ticket/15346#comment:33
https://trac.sagemath.org/ticket/15346#comment:33
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.4</em> to <em>sage-6.5</em>
</li>
</ul>
TicketVolker BraunTue, 17 Feb 2015 19:28:13 GMTstatus, branch changed; resolution set
https://trac.sagemath.org/ticket/15346#comment:34
https://trac.sagemath.org/ticket/15346#comment:34
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>branch</strong>
changed from <em>u/kcrisman/15346</em> to <em>3ee8c6d29ce916b70e5c0f32a0ae961796344afd</em>
</li>
</ul>
Ticket