Opened 9 years ago
Closed 7 years ago
#13526 closed defect (fixed)
simple incorrect limit
Reported by: | pang | Owned by: | burcin |
---|---|---|---|
Priority: | trivial | Milestone: | sage-6.3 |
Component: | symbolics | Keywords: | symbolic, limit |
Cc: | Merged in: | ||
Authors: | Peter Bruin | Reviewers: | Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | 5f3154b (Commits, GitHub, GitLab) | Commit: | 5f3154b1ae2ce3271d614220d7320cd86adcb690 |
Dependencies: | #13973 | Stopgaps: |
Description
Sage incorrectly computes:
var('n') l = (3^n + (-2)^n) / (3^(n+1) + (-2)^(n+1)) l.limit(n=oo)
gives 0.
However,
var('n') l = (3^n + (-2.0)^n) / (3^(n+1) + (-2)^(n+1)) l.limit(n=oo)
gives the correct result 1/3, and
var('n') assume(n,'integer') l = (3^n + (-2)^n) / (3^(n+1) + (-2)^(n+1)) l.limit(n=oo)
also does.
maxima also gives the value 0 to the corresponding limits, but changing (-2)\^{n by (-2.0)\}n only produce meaningless results.
Change History (15)
comment:1 follow-up: ↓ 2 Changed 9 years ago by
comment:2 in reply to: ↑ 1 Changed 9 years ago by
Replying to kcrisman:
Did you report this upstream?
I'd rather say: did you try this with maxima 5.28.0 ? (Sage still uses 5.26.0)
comment:3 Changed 9 years ago by
Well, fair enough.
Maxima 5.28.0 http://maxima.sourceforge.net using Lisp SBCL 1.0.55.0-abb03f9 (%i2) limit( (3^n+(-2.0)^n)/(3^(n+1)+(-2)^(n+1)),n,inf); rat: replaced -2.0 by -2/1 = -2.0 rat: replaced -2.0 by -2/1 = -2.0 rat: replaced 3.141592653589793 by 80143857/25510582 = 3.141592653589793 rat: replaced 3.141592653589793 by 80143857/25510582 = 3.141592653589793 rat: replaced -.693147180559945 by -13614799/19642003 = -.693147180559946 rat: replaced -.693147180559945 by -13614799/19642003 = -.693147180559946 rat: replaced -.693147180559945 by -13614799/19642003 = -.693147180559946 rat: replaced -.693147180559945 by -13614799/19642003 = -.693147180559946 rat: replaced -.693147180559945 by -13614799/19642003 = -.693147180559946 rat: replaced .6931471805599453 by 13614799/19642003 = 0.693147180559946 (%o2) 0 (%i3) limit( (3^n+(-2)^n)/(3^(n+1)+(-2)^(n+1)),n,inf); (%o3) 0
while
sage: [l.subs(n=k) for k in [1.,10.^1,10.^2,10.^4,10.^6,10.^8,10.^10]] [0.0769230769230769, 0.343080200343806, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.333333333333333]
comment:4 follow-up: ↓ 5 Changed 9 years ago by
Karl, thanks for testing. By "report upstream": you mean to maxima? I didn't. I was puzzled that Sage and maxima behave so differently, so I chose to leave it for the expert. Should I?
comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6 Changed 9 years ago by
Replying to pang:
Karl, thanks for testing. By "report upstream": you mean to maxima? I didn't. I was puzzled that Sage and maxima behave so differently, so I chose to leave it for the expert. Should I?
Well, 5.26.0 is an old version, and if the bug does not show itself in 5.28.0, such a report makes little sense. By the way, Karl's 5.28.0 is compiled with a different Lisp compiler, SBCL, not ECL, so it's not the end of the story. E.g. there could be a bug in ECL, and not in Maxima.
comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 9 years ago by
Replying to dimpase:
Well, 5.26.0 is an old version, and if the bug does not show itself in 5.28.0, such a report makes little sense.
The bug does show in 5.28: it gives 0 instead of 1/3.
comment:7 in reply to: ↑ 6 Changed 9 years ago by
comment:8 Changed 8 years ago by
- Milestone set to sage-5.11
- Report Upstream changed from N/A to Fixed upstream, in a later stable release.
Fixed in Maxima 5.30.0: #13973.
comment:9 Changed 8 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:10 Changed 7 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:11 Changed 7 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:12 Changed 7 years ago by
- Branch set to u/pbruin/13526-maxima_rational_function_limit
- Commit set to 5f3154b1ae2ce3271d614220d7320cd86adcb690
- Dependencies set to #13973
- Priority changed from minor to trivial
- Report Upstream changed from Fixed upstream, in a later stable release. to N/A
- Status changed from new to needs_review
Added the example from the original report as a doctest.
comment:13 Changed 7 years ago by
- Reviewers set to Travis Scrimshaw
- Status changed from needs_review to positive_review
LGTM.
comment:14 Changed 7 years ago by
Ah, and this branch is properly based on the Maxima update, phew :-)
comment:15 Changed 7 years ago by
- Branch changed from u/pbruin/13526-maxima_rational_function_limit to 5f3154b1ae2ce3271d614220d7320cd86adcb690
- Resolution set to fixed
- Status changed from positive_review to closed
Did you report this upstream?