# HG changeset patch
# User Burcin Erocal <burcin@erocal.org>
# Date 1271061088 -7200
# Node ID 8e4446fee52394f32e85aab8c3391a43a9081102
# Parent 275ab5ccad4ab867c400bedc990af40c37b32716
trac 8237: fix conversion of different infinities back from maxima
diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
a
|
b
|
|
964 | 964 | -x/sqrt(-x^2 + 1) |
965 | 965 | sage: limit(g, x=1, dir='below') |
966 | 966 | -Infinity |
| 967 | |
| 968 | TESTS:: |
| 969 | |
| 970 | sage: limit(1/x,x=0) |
| 971 | Infinity |
| 972 | sage: limit(1/x,x=0,dir='above') |
| 973 | +Infinity |
| 974 | sage: limit(1/x,x=0,dir='below') |
| 975 | -Infinity |
967 | 976 | """ |
968 | 977 | if not isinstance(ex, Expression): |
969 | 978 | ex = SR(ex) |
… |
… |
|
1407 | 1416 | symtable = {'%pi':'pi', '%e': 'e', '%i':'I', '%gamma':'euler_gamma', |
1408 | 1417 | 'li[2]':'polylog2', 'li[3]':'polylog3'} |
1409 | 1418 | |
1410 | | from sage.symbolic.pynac import register_symbol |
1411 | | from sage.rings.infinity import infinity, minus_infinity |
1412 | | register_symbol(infinity, dict(maxima='inf')) |
1413 | | register_symbol(minus_infinity, dict(maxima='minf')) |
1414 | | |
1415 | 1419 | from sage.misc.multireplace import multiple_replace |
1416 | 1420 | import re |
1417 | 1421 | |
diff --git a/sage/calculus/functional.py b/sage/calculus/functional.py
a
|
b
|
|
311 | 311 | sage: lim(exp(x), x=-oo) |
312 | 312 | 0 |
313 | 313 | sage: lim(1/x, x=0) |
314 | | +Infinity |
| 314 | Infinity |
315 | 315 | sage: limit(sqrt(x^2+x+1)+x, taylor=True, x=-oo) |
316 | 316 | -1/2 |
317 | 317 | sage: limit((tan(sin(x)) - sin(tan(x)))/x^7, taylor=True, x=0) |
diff --git a/sage/symbolic/constants.py b/sage/symbolic/constants.py
a
|
b
|
|
197 | 197 | 13.271347940197249310098819199575813940871106820003074817832971189555 |
198 | 198 | sage: RDF(a) |
199 | 199 | 13.2713479402 |
| 200 | |
| 201 | Test if #8237 is fixed:: |
| 202 | |
| 203 | sage: maxima('infinity').sage() |
| 204 | Infinity |
| 205 | sage: maxima('inf').sage() |
| 206 | +Infinity |
| 207 | sage: maxima('minf').sage() |
| 208 | -Infinity |
200 | 209 | """ |
201 | 210 | ############################################################################### |
202 | 211 | # Sage: Open Source Mathematical Software |
203 | 212 | # Copyright (C) 2008 William Stein <wstein@gmail.com> |
204 | | # Copyright (C) 2008 Burcin Erocal <burcin@erocal.org> |
| 213 | # Copyright (C) 2008-2010 Burcin Erocal <burcin@erocal.org> |
205 | 214 | # 2009 Mike Hansen <mhansen@gmail.com> |
206 | 215 | # Distributed under the terms of the GNU General Public License (GPL), |
207 | 216 | # version 2 or any later version. The full text of the GPL is available at: |
… |
… |
|
218 | 227 | constants_name_table[repr(unsigned_infinity)] = unsigned_infinity |
219 | 228 | constants_name_table[repr(minus_infinity)] = minus_infinity |
220 | 229 | |
| 230 | import sage.symbolic.pynac |
| 231 | sage.symbolic.pynac.register_symbol(infinity, {'maxima':'inf'}) |
| 232 | sage.symbolic.pynac.register_symbol(minus_infinity, {'maxima':'minf'}) |
| 233 | sage.symbolic.pynac.register_symbol(unsigned_infinity, {'maxima':'infinity'}) |
| 234 | |
221 | 235 | def unpickle_Constant(class_name, name, conversions, latex, mathml, domain): |
222 | 236 | """ |
223 | 237 | EXAMPLES:: |