# HG changeset patch
# User D. S. McNeil <dsm054@gmail.com>
# Date 1338006426 25200
# Node ID 492d4883f71339510efec470ecadd717b818dbba
# Parent 6c345ac8a80ecf9ed03a07896b98c608aa79f1e5
Trac #12345: allow MinusInfinity to work with sympy
diff --git a/sage/rings/infinity.py b/sage/rings/infinity.py
a
|
b
|
|
1193 | 1193 | """ |
1194 | 1194 | raise SignError, "cannot take square root of negative infinity" |
1195 | 1195 | |
| 1196 | def _sympy_(self): |
| 1197 | """ |
| 1198 | Converts -oo to sympy -oo. |
| 1199 | |
| 1200 | Then you don't have to worry which oo you use, like in these |
| 1201 | examples: |
| 1202 | |
| 1203 | EXAMPLE:: |
| 1204 | |
| 1205 | sage: import sympy |
| 1206 | sage: bool(-oo == -sympy.oo) |
| 1207 | True |
| 1208 | sage: bool(SR(-oo) == -sympy.oo) |
| 1209 | True |
| 1210 | sage: bool((-oo)._sympy_() == -sympy.oo) |
| 1211 | True |
| 1212 | |
| 1213 | """ |
| 1214 | import sympy |
| 1215 | return -sympy.oo |
| 1216 | |
| 1217 | |
1196 | 1218 | class PlusInfinity(_uniq, AnInfinity, PlusInfinityElement): |
1197 | 1219 | |
1198 | 1220 | _sign = 1 |
diff --git a/sage/symbolic/integration/integral.py b/sage/symbolic/integration/integral.py
a
|
b
|
|
662 | 662 | sage: F(x=1, a=7).numerical_approx() # abs tol 1e-10 |
663 | 663 | 4.32025625668262 |
664 | 664 | |
| 665 | Verify that MinusInfinity works with sympy (:trac:`12345`):: |
| 666 | |
| 667 | sage: integral(1/x^2, x, -infinity, -1, algorithm='sympy') |
| 668 | 1 |
| 669 | |
665 | 670 | """ |
666 | 671 | expression, v, a, b = _normalize_integral_input(expression, v, a, b) |
667 | 672 | if algorithm is not None: |