Open rtoy opened 2 weeks ago
Imported from SourceForge on 2024-07-01 18:02:28 Created by robert_dodier on 2016-12-30 06:55:03 Original: https://sourceforge.net/p/maxima/bugs/3267/#3abc
I find that intosum
helps sumcontract
find the expected result.
(%i11) intosum (sum(X(i),i,1,n+1)-sum(X(i),i,1,n));
n + 1 n
==== ====
\ \
(%o11) > X(i) + > (- X(i))
/ /
==== ====
i = 1 i = 1
(%i12) sumcontract (intosum (sum(X(i),i,1,n+1)-sum(X(i),i,1,n)));
(%o12) X(n + 1)
What do you think -- is this good enough? The documentation for sumcontract
does mention intosum
although it doesn't explain why one would do that. Certainly the documentation can be improved.
Imported from SourceForge on 2024-07-01 18:02:30 Created by charpent on 2016-12-30 11:32:57 Original: https://sourceforge.net/p/maxima/bugs/3267/#3abc/8806
On 30/12/2016 07:55, Robert Dodier wrote:
I find that |intosum| helps |sumcontract| find the expected result.
(%i11) intosum (sum(X(i),i,1,n+1)-sum(X(i),i,1,n)); n + 1 n ==== ==== \ \ (%o11) > X(i) + > (- X(i)) / / ==== ==== i = 1 i = 1 (%i12) sumcontract (intosum (sum(X(i),i,1,n+1)-sum(X(i),i,1,n))); (%o12) X(n + 1)
What do you think -- is this good enough?
Well... yes and no (see below).
The documentation for |sumcontract| does mention |intosum| although it doesn't explain why one would do that. Certainly the documentation can be improved.
Following the doc, I had tried
sumcontract(intosum(sum(X(i),,i,1,n))-intosum(sum(X(i),i,1,n-1)));
which was unhelpful, as you might think. An example (such as the one I
used to report the bug) might clarify the sentence...
To be frank, I think that the description of intosum
does not
allow to understand why it should help in this case : there is no
"external" factor to intern in the sum( except the sight of the
operation), and the doc does not help to understand why and how
sum(X(i),i,1,n+1)
is interpreted as
sum((=X(i),i,1,n)+X(n+1)
. And even less this behavior :
(%i21) sumcontract(intosum(sum(X(i),i,1,n+3)-sum(X(i),i,1,n)));
(%o21) X(n + 3) + X(n + 2) + X(n + 1)
(%i22) sumcontract(intosum(sum(X(i),i,4,n+3)-sum(X(i),i,1,n)));
(%o22) X(n + 3) + X(n + 2) + X(n + 1) - X(3) - X(2) - X(1)
This kind of result is something quite easy to miss when working "manually" (i. e. with pencil, eraser and paper) ; that's where CAS are extremely valuable : these possibilities should not be missed.
More generally, that's something that could be tried by Maxima itself, possibly under the control of an option.
Something similar could (should ?) be done for products, which currently
have not facilities similar to sumcontract
and intosum
Finally, I note that some obvious sum-to-product and product-to-sum
equalities are missed by Maxima (-that should be implemented as
log()
and exp()
properties ; there might be other
opportinities for trig functions...) :
(%i20) is(equal(log(product(X(i),i,1,n)),sum(log(X(i)),i,1,n)));
(%o20) unknown
"The competition" does not seem to be in better shape : neither Sympy nor Mathematica can get the result obtained in Maxima.
FYI : I note that Sage doesn't implement product
and that Sage's
use of Maxima's product
is false. I'll file a ticket against it.
HTH,
-- Emmanuel Charpentier
[bugs:#3267] https://sourceforge.net/p/maxima/bugs/3267/ Maxima misses an obvious simplification with sums
Status: open Group: None Labels: simplify simplify_sum sum sumcontract Created: Thu Dec 29, 2016 04:18 PM UTC by Emmanuel Charpentier Last Updated: Thu Dec 29, 2016 04:18 PM UTC Owner: nobody
My test system :
(%i4) bug_report();
Please report bugs to: http://sourceforge.net/p/maxima/bugs To report a bug, you must have a Sourceforge account. Please include the following information with your bug report:
Maxima version: "5.38.1" Maxima build date: "2016-11-25 20:51:03" Host type: "x86_64-pc-linux-gnu" Lisp implementation type: "GNU Common Lisp (GCL)" Lisp implementation version: "GCL 2.6.12"
The problem : I want to simplify sums of vectors of unspecified quantities, here represented as unspecified finctions with an integer argument. The simplest case is :
(%i1) display2d:false;
(%o1) false (%i2) sumcontract(sum(X(i),i,1,n+1)+sum(X(i),i,1,n));
(%o2) X(n+1)+2*'sum(X(i),i,1,n)
So far, so good. But :
(%i3) sumcontract(sum(X(i),i,1,n+1)-sum(X(i),i,1,n));
(%o3) 'sum(X(i),i,1,n+1)-'sum(X(i),i,1,n)
|(%o2)| let me hope that |(%o3)| would be |X(n+1)| (the simplified result). Bit no. Ad adding |,simpsum| doesn't fix the problem.
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/maxima/bugs/3267/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Imported from SourceForge on 2024-07-01 18:02:32 Created by robert_dodier on 2016-12-31 07:03:25 Original: https://sourceforge.net/p/maxima/bugs/3267/#f1b2
OK, I see your point. I will think about how to get sumcontract
to call intosum
as necessary. (The question seems a little subtle to me. I don't know if it's possible for intosum
to actually make the problem harder for sumcontract
. If so, it can't be called always. Also, calling intosum
might cause sumcontract
to yield a different result. Which one should be returned? Is there any way to determine which result is "simpler" or preferable in some other way? It's not important to answer these questions now; these are just the thoughts going through my head.)
About analogues of sumcontract
and intosum
for product
expressions, I agree that would be a good idea. Feel free to submit a "Feature Request" ticket for it.
About simplifying log(product(...))
to sum(log(...))
, note that logexpand = all
or logexpand = super
enables this. I guess that's not mentioned in the documentation; I'll add a note.
Imported from SourceForge on 2024-07-01 18:02:27 Created by charpent on 2016-12-29 16:18:06 Original: https://sourceforge.net/p/maxima/bugs/3267
My test system :
The problem : I want to simplify sums of vectors of unspecified quantities, here represented as unspecified finctions with an integer argument. The simplest case is :
So far, so good. But :
(%o2)
let me hope that(%o3)
would beX(n+1)
(the simplified result). Bit no. Ad adding,simpsum
doesn't fix the problem.