Repository: sympy/sympy

Issue:
Bug in Mul
`Mul(zoo, zoo, 0)` returns `zoo`, but should be `NaN`.

Discussion:

Patch:
diff --git a/doc/src/gotchas.rst b/doc/src/gotchas.rst
index 977f9b5138..b7e2a7d50b 100644
--- a/doc/src/gotchas.rst
+++ b/doc/src/gotchas.rst
@@ -568,28 +568,6 @@ of :obj:`~.asin`, :obj:`~.acos` and so on instead of the usual ``arcsin``
 and ``arccos``.  Use the methods described in :ref:`Symbols <symbols>`
 above to see the names of all SymPy functions.
 
-Sqrt is not a Function
-----------------------
-
-There is no ``sqrt`` function in the same way that there is an
-exponential function (``exp``). ``sqrt(x)`` is used to represent
-``Pow(x, S(1)/2)`` so if you want to know if an expression has any
-square roots in it, ``expr.has(sqrt)`` will not work. You must look
-for ``Pow`` with an exponent of one half (or negative one half if it
-is in a denominator, e.g.
-
-    >>> (y + sqrt(x)).find(Wild('w')**S.Half)
-    {sqrt(x)}
-    >>> (y + 1/sqrt(x)).find(Wild('w')**-S.Half)
-    {1/sqrt(x)}
-
-If you are interested in any power of the ``sqrt`` then the
-following pattern would be appropriate
-
-    >>> sq = lambda s: s.is_Pow and s.exp.is_Rational and s.exp.q == 2
-    >>> (y + sqrt(x)**3).find(sq)
-    {x**(3/2)}
-
 Special Symbols
 ===============
 
diff --git a/sympy/core/mul.py b/sympy/core/mul.py
index 06b942bd7c..c744438225 100644
--- a/sympy/core/mul.py
+++ b/sympy/core/mul.py
@@ -291,9 +291,6 @@ def flatten(cls, seq):
                 if not coeff:
                     # 0 * zoo = NaN
                     return [S.NaN], [], None
-                if coeff is S.ComplexInfinity:
-                    # zoo * zoo = zoo
-                    return [S.ComplexInfinity], [], None
                 coeff = S.ComplexInfinity
                 continue
 
diff --git a/sympy/core/symbol.py b/sympy/core/symbol.py
index 4630984cfe..4a0ecb63c0 100644
--- a/sympy/core/symbol.py
+++ b/sympy/core/symbol.py
@@ -189,6 +189,20 @@ def _sanitize(assumptions, obj=None):
 
         # sanitize other assumptions so 1 -> True and 0 -> False
         for key in list(assumptions.keys()):
+            from collections import defaultdict
+            from sympy.utilities.exceptions import SymPyDeprecationWarning
+            keymap = defaultdict(lambda: None)
+            keymap.update({'bounded': 'finite', 'unbounded': 'infinite', 'infinitesimal': 'zero'})
+            if keymap[key]:
+                SymPyDeprecationWarning(
+                    feature="%s assumption" % key,
+                    useinstead="%s" % keymap[key],
+                    issue=8071,
+                    deprecated_since_version="0.7.6").warn()
+                assumptions[keymap[key]] = assumptions[key]
+                assumptions.pop(key)
+                key = keymap[key]
+
             v = assumptions[key]
             if v is None:
                 assumptions.pop(key)
diff --git a/sympy/functions/elementary/miscellaneous.py b/sympy/functions/elementary/miscellaneous.py
index 3bdba52d1f..9f6b7cbd25 100644
--- a/sympy/functions/elementary/miscellaneous.py
+++ b/sympy/functions/elementary/miscellaneous.py
@@ -70,7 +70,7 @@ def sqrt(arg, evaluate=None):
     Examples
     ========
 
-    >>> from sympy import sqrt, Symbol, S
+    >>> from sympy import sqrt, Symbol
     >>> x = Symbol('x')
 
     >>> sqrt(x)
@@ -115,25 +115,6 @@ def sqrt(arg, evaluate=None):
     >>> [rootof(x**2-3,i) for i in (0,1)]
     [-sqrt(3), sqrt(3)]
 
-    Although ``sqrt`` is printed, there is no ``sqrt`` function so looking for
-    ``sqrt`` in an expression will fail:
-
-    >>> from sympy.utilities.misc import func_name
-    >>> func_name(sqrt(x))
-    'Pow'
-    >>> sqrt(x).has(sqrt)
-    Traceback (most recent call last):
-      ...
-    sympy.core.sympify.SympifyError: Sympify of expression 'could not parse
-    '<function sqrt at 0x7f79ad860f80>'' failed, because of exception being
-    raised:
-    SyntaxError: invalid syntax
-
-    To find ``sqrt`` look for ``Pow`` with an exponent of ``1/2``:
-
-    >>> (x + 1/sqrt(x)).find(lambda i: i.is_Pow and abs(i.exp) is S.Half)
-    {1/sqrt(x)}
-
     See Also
     ========
 
diff --git a/sympy/printing/glsl.py b/sympy/printing/glsl.py
index 4546cad51a..2b8267cf4e 100644
--- a/sympy/printing/glsl.py
+++ b/sympy/printing/glsl.py
@@ -53,7 +53,7 @@ class GLSLPrinter(CodePrinter):
         'allow_unknown_functions': False,
         'contract': True,
         'error_on_reserved': False,
-        'reserved_word_suffix': '_',
+        'reserved_word_suffix': '_'
     }
 
     def __init__(self, settings={}):
diff --git a/sympy/printing/jscode.py b/sympy/printing/jscode.py
index ddf6feedf1..9e08c6a13c 100644
--- a/sympy/printing/jscode.py
+++ b/sympy/printing/jscode.py
@@ -57,7 +57,7 @@ class JavascriptCodePrinter(CodePrinter):
         'user_functions': {},
         'human': True,
         'allow_unknown_functions': False,
-        'contract': True,
+        'contract': True
     }  # type: Dict[str, Any]
 
     def __init__(self, settings={}):
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index cf533f7928..99e0f57a03 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -125,7 +125,6 @@ class LatexPrinter(Printer):
     printmethod = "_latex"
 
     _default_settings = {
-        "full_prec": False,
         "fold_frac_powers": False,
         "fold_func_brackets": False,
         "fold_short_frac": None,
@@ -145,8 +144,6 @@ class LatexPrinter(Printer):
         "gothic_re_im": False,
         "decimal_separator": "period",
         "perm_cyclic": True,
-        "min": None,
-        "max": None,
     }  # type: Dict[str, Any]
 
     def __init__(self, settings=None):
@@ -417,10 +414,7 @@ def _print_AppliedPermutation(self, expr):
     def _print_Float(self, expr):
         # Based off of that in StrPrinter
         dps = prec_to_dps(expr._prec)
-        strip = False if self._settings['full_prec'] else True
-        low = self._settings["min"] if "min" in self._settings else None
-        high = self._settings["max"] if "max" in self._settings else None
-        str_real = mlib.to_str(expr._mpf_, dps, strip_zeros=strip, min_fixed=low, max_fixed=high)
+        str_real = mlib.to_str(expr._mpf_, dps, strip_zeros=True)
 
         # Must always have a mul symbol (as 2.5 10^{20} just looks odd)
         # thus we use the number separator
@@ -2556,8 +2550,8 @@ def translate(s):
         return s
 
 
-def latex(expr, full_prec=False, min=None, max=None, fold_frac_powers=False,
-          fold_func_brackets=False, fold_short_frac=None, inv_trig_style="abbreviated",
+def latex(expr, fold_frac_powers=False, fold_func_brackets=False,
+          fold_short_frac=None, inv_trig_style="abbreviated",
           itex=False, ln_notation=False, long_frac_ratio=None,
           mat_delim="[", mat_str=None, mode="plain", mul_symbol=None,
           order=None, symbol_names=None, root_notation=True,
@@ -2567,8 +2561,6 @@ def latex(expr, full_prec=False, min=None, max=None, fold_frac_powers=False,
 
     Parameters
     ==========
-    full_prec: boolean, optional
-        If set to True, a floating point number is printed with full precision.
     fold_frac_powers : boolean, optional
         Emit ``^{p/q}`` instead of ``^{\frac{p}{q}}`` for fractional powers.
     fold_func_brackets : boolean, optional
@@ -2636,12 +2628,6 @@ def latex(expr, full_prec=False, min=None, max=None, fold_frac_powers=False,
         when ``comma`` is specified. Lists, sets, and tuple are printed with semicolon
         separating the elements when ``comma`` is chosen. For example, [1; 2; 3] when
         ``comma`` is chosen and [1,2,3] for when ``period`` is chosen.
-    min: Integer or None, optional
-        Sets the lower bound for the exponent to print floating point numbers in
-        fixed-point format.
-    max: Integer or None, optional
-        Sets the upper bound for the exponent to print floating point numbers in
-        fixed-point format.
 
     Notes
     =====
@@ -2753,7 +2739,6 @@ def latex(expr, full_prec=False, min=None, max=None, fold_frac_powers=False,
         symbol_names = {}
 
     settings = {
-        'full_prec': full_prec,
         'fold_frac_powers': fold_frac_powers,
         'fold_func_brackets': fold_func_brackets,
         'fold_short_frac': fold_short_frac,
@@ -2773,8 +2758,6 @@ def latex(expr, full_prec=False, min=None, max=None, fold_frac_powers=False,
         'gothic_re_im': gothic_re_im,
         'decimal_separator': decimal_separator,
         'perm_cyclic' : perm_cyclic,
-        'min': min,
-        'max': max,
     }
 
     return LatexPrinter(settings).doprint(expr)
diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py
index ee27b3c027..93a1e1be70 100644
--- a/sympy/printing/pycode.py
+++ b/sympy/printing/pycode.py
@@ -92,7 +92,7 @@ class AbstractPythonCodePrinter(CodePrinter):
         inline=True,
         fully_qualified_modules=True,
         contract=False,
-        standard='python3',
+        standard='python3'
     )
 
     def __init__(self, settings=None):
diff --git a/sympy/printing/str.py b/sympy/printing/str.py
index beae454af7..94b27530ee 100644
--- a/sympy/printing/str.py
+++ b/sympy/printing/str.py
@@ -24,8 +24,6 @@ class StrPrinter(Printer):
         "sympy_integers": False,
         "abbrev": False,
         "perm_cyclic": True,
-        "min": None,
-        "max": None,
     }  # type: Dict[str, Any]
 
     _relationals = dict()  # type: Dict[str, str]
@@ -693,9 +691,7 @@ def _print_Float(self, expr):
             strip = True
         elif self._settings["full_prec"] == "auto":
             strip = self._print_level > 1
-        low = self._settings["min"] if "min" in self._settings else None
-        high = self._settings["max"] if "max" in self._settings else None
-        rv = mlib_to_str(expr._mpf_, dps, strip_zeros=strip, min_fixed=low, max_fixed=high)
+        rv = mlib_to_str(expr._mpf_, dps, strip_zeros=strip)
         if rv.startswith('-.0'):
             rv = '-0.' + rv[3:]
         elif rv.startswith('.0'):


Test patch:
diff --git a/sympy/core/tests/test_arit.py b/sympy/core/tests/test_arit.py
index d527e99f30..807048dc50 100644
--- a/sympy/core/tests/test_arit.py
+++ b/sympy/core/tests/test_arit.py
@@ -2112,3 +2112,7 @@ def test__neg__():
     with distribute(False):
         eq = -(x + y)
         assert eq.is_Mul and eq.args == (-1, x + y)
+
+
+def test_issue_18507():
+    assert Mul(zoo, zoo, 0) is nan
diff --git a/sympy/integrals/tests/test_integrals.py b/sympy/integrals/tests/test_integrals.py
index b22a807ab8..2970b2cb7d 100644
--- a/sympy/integrals/tests/test_integrals.py
+++ b/sympy/integrals/tests/test_integrals.py
@@ -1649,10 +1649,6 @@ def test_issue_2975():
     y = Symbol('y')
     assert integrate(1/(y**2+C)**(S(3)/2), (y, -w/2, w/2)) == w/(C**(S(3)/2)*sqrt(1 + w**2/(4*C)))
 
-def test_issue_4231():
-    f = (1 + 2*x + sqrt(x + log(x))*(1 + 3*x) + x**2)/(x*(x + sqrt(x + log(x)))*sqrt(x + log(x)))
-    assert integrate(f, x) == 2*sqrt(x + log(x)) + 2*log(x + sqrt(x + log(x)))
-
 def test_issue_17841():
     f = diff(1/(x**2+x+I), x)
     assert integrate(f, x) == 1/(x**2 + x + I)
diff --git a/sympy/printing/tests/test_latex.py b/sympy/printing/tests/test_latex.py
index f87f361e9a..d88a160be0 100644
--- a/sympy/printing/tests/test_latex.py
+++ b/sympy/printing/tests/test_latex.py
@@ -214,14 +214,6 @@ def test_latex_Float():
     assert latex(Float(1.0e-100)) == r"1.0 \cdot 10^{-100}"
     assert latex(Float(1.0e-100), mul_symbol="times") == \
         r"1.0 \times 10^{-100}"
-    assert latex(Float('10000.0'), full_prec=False, min=-2, max=2) == \
-        r"1.0 \cdot 10^{4}"
-    assert latex(Float('10000.0'), full_prec=False, min=-2, max=4) == \
-        r"1.0 \cdot 10^{4}"
-    assert latex(Float('10000.0'), full_prec=False, min=-2, max=5) == \
-        r"10000.0"
-    assert latex(Float('0.099999'), full_prec=True,  min=-2, max=5) == \
-        r"9.99990000000000 \cdot 10^{-2}"
 
 
 def test_latex_vector_expressions():
diff --git a/sympy/printing/tests/test_str.py b/sympy/printing/tests/test_str.py
index f4a980e46e..c2b2936c30 100644
--- a/sympy/printing/tests/test_str.py
+++ b/sympy/printing/tests/test_str.py
@@ -513,10 +513,6 @@ def test_Float():
                                      '5028841971693993751058209749445923')
     assert str(pi.round(-1)) == '0.0'
     assert str((pi**400 - (pi**400).round(1)).n(2)) == '-0.e+88'
-    assert sstr(Float("100"), full_prec=False, min=-2, max=2) == '1.0e+2'
-    assert sstr(Float("100"), full_prec=False, min=-2, max=3) == '100.0'
-    assert sstr(Float("0.1"), full_prec=False, min=-2, max=3) == '0.1'
-    assert sstr(Float("0.099"), min=-2, max=3) == '9.90000000000000e-2'
 
 
 def test_Relational():
diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py
index 48887a3db9..a001378e8a 100644
--- a/sympy/series/tests/test_limits.py
+++ b/sympy/series/tests/test_limits.py
@@ -595,7 +595,6 @@ def test_issue_12571():
 def test_issue_14590():
     assert limit((x**3*((x + 1)/x)**x)/((x + 1)*(x + 2)*(x + 3)), x, oo) == exp(1)
 
-
 def test_issue_17431():
     assert limit(((n + 1) + 1) / (((n + 1) + 2) * factorial(n + 1)) *
                  (n + 2) * factorial(n) / (n + 1), n, oo) == 0
@@ -607,16 +606,8 @@ def test_issue_17431():
 def test_issue_17671():
     assert limit(Ei(-log(x)) - log(log(x))/x, x, 1) == EulerGamma
 
-
 def test_issue_18306():
     assert limit(sin(sqrt(x))/sqrt(sin(x)), x, 0, '+') == 1
 
-
 def test_issue_18442():
     assert limit(tan(x)**(2**(sqrt(pi))), x, oo, dir='-') == AccumBounds(-oo, oo)
-
-
-def test_issue_18508():
-    assert limit(sin(x)/sqrt(1-cos(x)), x, 0) == sqrt(2)
-    assert limit(sin(x)/sqrt(1-cos(x)), x, 0, dir='+') == sqrt(2)
-    assert limit(sin(x)/sqrt(1-cos(x)), x, 0, dir='-') == -sqrt(2)
diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py
index 81b9524add..0f92865426 100644
--- a/sympy/solvers/tests/test_solveset.py
+++ b/sympy/solvers/tests/test_solveset.py
@@ -632,9 +632,6 @@ def test_solve_abs():
             ImageSet(Lambda(n, n*pi - (-1)**(-n)*pi/2), S.Integers)))
 
 
-def test_issue_9824():
-    assert solveset(sin(x)**2 - 2*sin(x) + 1, x) == ImageSet(Lambda(n, 2*n*pi + pi/2), S.Integers)
-    assert solveset(cos(x)**2 - 2*cos(x) + 1, x) == ImageSet(Lambda(n, 2*n*pi), S.Integers)
 
 def test_issue_9565():
     assert solveset_real(Abs((x - 1)/(x - 5)) <= Rational(1, 3), x) == Interval(-1, 2)