# HG changeset patch
# User Burcin Erocal <burcin@erocal.org>
# Date 1266675559 -3600
# Node ID 8a4c49d44fa35e2cfa1ecaf6d02d821451205115
# Parent 493c4a6065bf92d13501a36a9bd9affc705d2cdb
trac 8237: fix conversion of different infinities back from maxima
diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
a
|
b
|
|
986 | 986 | -x/sqrt(-x^2 + 1) |
987 | 987 | sage: limit(g, x=1, dir='below') |
988 | 988 | -Infinity |
| 989 | |
| 990 | TESTS:: |
| 991 | |
| 992 | sage: limit(1/x,x=0) |
| 993 | Infinity |
| 994 | sage: limit(1/x,x=0,dir='above') |
| 995 | +Infinity |
| 996 | sage: limit(1/x,x=0,dir='below') |
| 997 | -Infinity |
989 | 998 | """ |
990 | 999 | if not isinstance(ex, Expression): |
991 | 1000 | ex = SR(ex) |
… |
… |
|
1428 | 1437 | symtable = {'%pi':'pi', '%e': 'e', '%i':'I', '%gamma':'euler_gamma', |
1429 | 1438 | 'li[2]':'polylog2', 'li[3]':'polylog3'} |
1430 | 1439 | |
1431 | | from sage.symbolic.pynac import register_symbol |
1432 | | from sage.rings.infinity import infinity, minus_infinity |
1433 | | register_symbol(infinity, dict(maxima='inf')) |
1434 | | register_symbol(minus_infinity, dict(maxima='minf')) |
1435 | | |
1436 | 1440 | from sage.misc.multireplace import multiple_replace |
1437 | 1441 | |
1438 | 1442 | import re |
… |
… |
|
1476 | 1480 | sage: a.sage() |
1477 | 1481 | x != 0 |
1478 | 1482 | """ |
| 1483 | global _syms |
| 1484 | _syms = sage.symbolic.pynac.symbol_table.get('maxima', {}) |
1479 | 1485 | syms = dict(_syms) |
1480 | 1486 | |
1481 | 1487 | if len(x) == 0: |
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:: |