Repository: sympy/sympy

Issue:
discrete_log expects to work with ints
```python
>>> discrete_log(5779, 3528, 6215)
687
>>> discrete_log(*Tuple(5779, 3528, 6215))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\ntheory\residue_ntheory.py", line 1300, in discrete_log
    return _discrete_log_pohlig_hellman(n, a, b, order)
  File "sympy\ntheory\residue_ntheory.py", line 1246, in _discrete_log_pohlig_hellman
    gj = pow(b, l[i], n)
TypeError: __sympifyit_wrapper() takes exactly 2 arguments (3 given)
```

Fixing this also fixes the error in #13178

Discussion:

Patch:
diff --git a/doc/src/modules/vector/coordsys.rst b/doc/src/modules/vector/coordsys.rst
index 6bc490363e..aa9c1fbca0 100644
--- a/doc/src/modules/vector/coordsys.rst
+++ b/doc/src/modules/vector/coordsys.rst
@@ -3,7 +3,7 @@ More about Coordinate Systems
 =============================
 
 We will now look at how we can initialize new coordinate systems in
-:mod:`sympy.vector`, transformed in user-defined
+:mod:`sympy.vector`, positioned and oriented in user-defined
 ways with respect to already-existing systems.
 
 Locating new systems
@@ -67,7 +67,7 @@ The orientation is shown in the diagram below:
 There are two ways to achieve this.
 
 Using a method of CoordSys3D directly
--------------------------------------
+--------------------------------------------
 
 This is the easiest, cleanest, and hence the recommended way of doing
 it.
@@ -178,29 +178,6 @@ location of the new systems.
 
 More on the ``express`` function in a bit.
 
-Transforming new system
-=======================
-
-The most general way of creating user-defined system is to use
-``transformation`` parameter in ``CoordSys3D``. Here we can define
-any transformation equations. If we are interested in some typical
-curvilinear coordinate system different that Cartesian, we can also
-use some predefined ones. It could be also possible to translate or
-rotate system by setting appropriate transformation equations.
-
-  >>> from sympy.vector import CoordSys3D
-  >>> from sympy import sin, cos
-  >>> A = CoordSys3D('A', transformation='spherical')
-  >>> B = CoordSys3D('A', transformation=lambda x,y,z: (x*sin(y), x*cos(y), z))
-
-
-In ``CoordSys3D`` is also dedicated method, ``create_new`` which works
-similarly to methods like ``locate_new``, ``orient_new_axis`` etc.
-
-  >>> from sympy.vector import CoordSys3D
-  >>> A = CoordSys3D('A')
-  >>> B = A.create_new('B', transformation='spherical')
-
 Expression of quantities in different coordinate systems
 ========================================================
 
diff --git a/doc/src/modules/vector/fields.rst b/doc/src/modules/vector/fields.rst
index 02841f3017..d4f23b3971 100644
--- a/doc/src/modules/vector/fields.rst
+++ b/doc/src/modules/vector/fields.rst
@@ -255,22 +255,6 @@ Or by using the dedicated function
   >>> directional_derivative(C.x*C.y*C.z, 3*C.i + 4*C.j + C.k)
   C.x*C.y + 4*C.x*C.z + 3*C.y*C.z
 
-Field operator in orthogonal curvilinear coordinate system
-==========================================================
-
-``vector`` package supports calculation in different kind of orthogonal
-curvilinear coordinate system. To do that, scaling factor (also known as
-Lame coefficients) are used to express ``curl``, ``divergence`` or ``gradient``
-in desired type of coordinate system.
-
-For example if we want to calculate ``gradient`` in cylindrical coordinate
-system all we need to do is to create proper coordinate system
-
-  >>> from sympy.vector import CoordSys3D
-  >>> c = CoordSys3D('c', transformation='cylindrical', variable_names=("r", "theta", "z"))
-  >>> gradient(c.r*c.theta*c.z)
-      c.theta*c.z*c.i + c.r*c.z/c.theta*c.j + c.r*c.theta*c.k
-
 Conservative and Solenoidal fields
 ==================================
 
diff --git a/examples/notebooks/IntegrationOverPolytopes.ipynb b/examples/notebooks/IntegrationOverPolytopes.ipynb
index d3cb721a18..eb077de53c 100644
--- a/examples/notebooks/IntegrationOverPolytopes.ipynb
+++ b/examples/notebooks/IntegrationOverPolytopes.ipynb
@@ -20,7 +20,7 @@
    "cell_type": "code",
    "execution_count": null,
    "metadata": {
-    "collapsed": true
+    "collapsed": false
    },
    "outputs": [],
    "source": [
@@ -43,22 +43,15 @@
     "collapsed": true
    },
    "source": [
-    "### polytope_integrate(poly, expr, **kwargs)\n",
-    "    Integrates polynomials over 2/3-Polytopes.\n",
-    "\n",
-    "    This function accepts the polytope in `poly` and the function in `expr` (uni/bi/trivariate polynomials are\n",
-    "    implemented) and returns the exact integral of `expr` over `poly`.\n",
+    "### polytope_integrate(poly, expr, **kwargs) :\n",
+    "    Pre-processes the input data for integrating univariate/bivariate polynomials over 2-Polytopes.\n",
     "    \n",
-    "    Parameters\n",
-    "    ---------------------------------------\n",
-    "    1. poly(Polygon) : 2/3-Polytope\n",
-    "    2. expr(SymPy expression) : uni/bi-variate polynomial for 2-Polytope and uni/bi/tri-variate for 3-Polytope\n",
+    "    poly(Polygon) : 2-Polytope\n",
+    "    expr(SymPy expression) : uni/bi-variate polynomial\n",
     "    \n",
     "    Optional Parameters\n",
-    "    ---------------------------------------\n",
-    "    1. clockwise(Boolean) : If user is not sure about orientation of vertices of the 2-Polytope and wants\n",
-    "       to clockwise sort the points.\n",
-    "    2. max_degree(Integer) : Maximum degree of any monomial of the input polynomial. This would require \n",
+    "    clockwise(Boolean) : If user is not sure about orientation of vertices and wants to clockwise sort the points.\n",
+    "    max_degree(Integer) : Maximum degree of any monomial of the input polynomial.\n",
     "     \n",
     "   #### Examples :"
    ]
@@ -66,7 +59,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "triangle = Polygon(Point(0,0), Point(1,1), Point(1,0))\n",
@@ -89,164 +84,14 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "### main_integrate3d(expr, facets, vertices, hp_params)\n",
-    "    Function to translate the problem of integrating uni/bi/tri-variate\n",
-    "    polynomials over a 3-Polytope to integrating over its faces.\n",
-    "    This is done using Generalized Stokes's Theorem and Euler's Theorem.\n",
-    "    \n",
-    "    Parameters\n",
-    "    ------------------\n",
-    "    1. expr : The input polynomial\n",
-    "    2. facets : Faces of the 3-Polytope(expressed as indices of `vertices`)\n",
-    "    3. vertices : Vertices that constitute the Polytope\n",
-    "    4. hp_params : Hyperplane Parameters of the facets\n",
-    "    \n",
-    "   #### Examples:"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "cube = [[(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)],\n",
-    "         [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0], [3, 1, 0, 2], [0, 4, 6, 2]]\n",
-    "vertices = cube[0]\n",
-    "faces = cube[1:]\n",
-    "hp_params = hyperplane_parameters(faces, vertices)\n",
-    "main_integrate3d(1, faces, vertices, hp_params)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "### polygon_integrate(facet, index, facets, vertices, expr, degree)\n",
-    "    Helper function to integrate the input uni/bi/trivariate polynomial\n",
-    "    over a certain face of the 3-Polytope.\n",
-    "    \n",
-    "    Parameters\n",
-    "    ------------------\n",
-    "    facet : Particular face of the 3-Polytope over which `expr` is integrated\n",
-    "    index : The index of `facet` in `facets`\n",
-    "    facets : Faces of the 3-Polytope(expressed as indices of `vertices`)\n",
-    "    vertices : Vertices that constitute the facet\n",
-    "    expr : The input polynomial\n",
-    "    degree : Degree of `expr`\n",
-    "    \n",
-    "   #### Examples:"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\n",
-    "                 (5, 0, 5), (5, 5, 0), (5, 5, 5)],\n",
-    "                 [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0],\n",
-    "                 [3, 1, 0, 2], [0, 4, 6, 2]]\n",
-    "facet = cube[1]\n",
-    "facets = cube[1:]\n",
-    "vertices = cube[0]\n",
-    "print(\"Area of polygon < [(0, 5, 0), (5, 5, 0), (5, 5, 5), (0, 5, 5)] > : \", polygon_integrate(facet, 0, facets, vertices, 1, 0))"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "### distance_to_side(point, line_seg)\n",
-    "\n",
-    "    Helper function to compute the distance between given 3D point and\n",
-    "    a line segment.\n",
-    "\n",
-    "    Parameters\n",
-    "    -----------------\n",
-    "    point : 3D Point\n",
-    "    line_seg : Line Segment\n",
-    "    \n",
-    "#### Examples:"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "point = (0, 0, 0)\n",
-    "distance_to_side(point, [(0, 0, 1), (0, 1, 0)])"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "### lineseg_integrate(polygon, index, line_seg, expr, degree)\n",
-    "    Helper function to compute the line integral of `expr` over `line_seg`\n",
-    "\n",
-    "    Parameters\n",
-    "    -------------\n",
-    "    polygon : Face of a 3-Polytope\n",
-    "    index : index of line_seg in polygon\n",
-    "    line_seg : Line Segment\n",
-    "#### Examples :"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "polygon = [(0, 5, 0), (5, 5, 0), (5, 5, 5), (0, 5, 5)]\n",
-    "line_seg = [(0, 5, 0), (5, 5, 0)]\n",
-    "print(lineseg_integrate(polygon, 0, line_seg, 1, 0))"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "### main_integrate(expr, facets, hp_params, max_degree=None)\n",
-    "\n",
-    "    Function to translate the problem of integrating univariate/bivariate\n",
-    "    polynomials over a 2-Polytope to integrating over its boundary facets.\n",
-    "    This is done using Generalized Stokes's Theorem and Euler's Theorem.\n",
-    "\n",
-    "    Parameters\n",
-    "    --------------------\n",
-    "    expr : The input polynomial\n",
-    "    facets : Facets(Line Segments) of the 2-Polytope\n",
-    "    hp_params : Hyperplane Parameters of the facets\n",
-    "\n",
-    "    Optional Parameters:\n",
-    "    --------------------\n",
-    "    max_degree : The maximum degree of any monomial of the input polynomial.\n",
+    "### integration_reduction(facets, index, a, b, expr, dims, degree) :\n",
+    "    facets : List of facets that decide the region enclose by 2-Polytope.\n",
+    "    index : The index of the facet with respect to which the integral is supposed to be found.\n",
+    "    a, b : Hyperplane parameters corresponding to facets.\n",
+    "    expr : Uni/Bi-variate Polynomial\n",
+    "    dims : List of symbols denoting axes\n",
+    "    degree : Degree of the homogeneous polynoimal(expr)\n",
     "    \n",
-    "#### Examples:"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "triangle = Polygon(Point(0, 3), Point(5, 3), Point(1, 1))\n",
-    "facets = triangle.sides\n",
-    "hp_params = hyperplane_parameters(triangle)\n",
-    "print(main_integrate(x**2 + y**2, facets, hp_params))\n"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "### integration_reduction(facets, index, a, b, expr, dims, degree)\n",
     "    This is a helper function for polytope_integrate. It relates the result of the integral of a polynomial over a\n",
     "    d-dimensional entity to the result of the same integral of that polynomial over the (d - 1)-dimensional \n",
     "    facet[index].\n",
@@ -258,22 +103,15 @@
     "    this function is a helper one and works for a facet which bounds the polytope(i.e. the intersection point with the\n",
     "    other facets is required), not for an independent line.\n",
     "    \n",
-    "    Parameters\n",
-    "    ------------------\n",
-    "    facets : List of facets that decide the region enclose by 2-Polytope.\n",
-    "    index : The index of the facet with respect to which the integral is supposed to be found.\n",
-    "    a, b : Hyperplane parameters corresponding to facets.\n",
-    "    expr : Uni/Bi-variate Polynomial\n",
-    "    dims : List of symbols denoting axes\n",
-    "    degree : Degree of the homogeneous polynoimal(expr)\n",
-    "    \n",
     "   #### Examples:"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "facets = [Segment2D(Point(0, 0), Point(1, 1)), Segment2D(Point(1, 1), Point(1, 0)), Segment2D(Point(0, 0), Point(1, 0))]\n",
@@ -298,7 +136,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "triangle = Polygon(Point(0,0), Point(1,1), Point(1,0))\n",
@@ -324,7 +164,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "print(\"Best origin for x**3*y on x + y = 3 : \", best_origin((1,1), 3, Segment2D(Point(0, 3), Point(3, 0)), x**3*y))\n",
@@ -348,7 +190,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "print(decompose(1 + x + x**2 + x*y))\n",
@@ -372,7 +216,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "print(norm((1, 2)))\n",
@@ -397,7 +243,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "print(intersection(Segment2D(Point(0, 0), Point(2, 2)), Segment2D(Point(1, 0), Point(0, 1))))\n",
@@ -420,7 +268,7 @@
    "cell_type": "code",
    "execution_count": null,
    "metadata": {
-    "collapsed": true
+    "collapsed": false
    },
    "outputs": [],
    "source": [
@@ -447,7 +295,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "hexagon = Polygon(Point(0, 0), Point(-sqrt(3) / 2, 0.5),\n",
@@ -476,7 +326,9 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {},
+   "metadata": {
+    "collapsed": false
+   },
    "outputs": [],
    "source": [
     "expr = x**2\n",
@@ -512,7 +364,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.6.0"
   }
  },
  "nbformat": 4,
diff --git a/sympy/integrals/intpoly.py b/sympy/integrals/intpoly.py
index a085c69de4..da84e0f5f5 100644
--- a/sympy/integrals/intpoly.py
+++ b/sympy/integrals/intpoly.py
@@ -1,6 +1,6 @@
 """
 Module to implement integration of uni/bivariate polynomials over
-2D Polytopes and uni/bi/trivariate polynomials over 3D Polytopes.
+2D Polytopes(Polygons).
 
 Uses evaluation techniques as described in Chin et al(2015)[1]
 
@@ -14,26 +14,27 @@
 from functools import cmp_to_key
 
 from sympy.core import S, diff, Expr, Symbol
-from sympy.geometry import Segment2D, Polygon, Point, Point2D
-from sympy.abc import x, y, z
+
+from sympy.geometry import Segment2D, Polygon, Point
+from sympy.abc import x, y
 
 from sympy.polys.polytools import LC, gcd_list, degree_list
 
 
 def polytope_integrate(poly, expr, **kwargs):
-    """Integrates polynomials over 2/3-Polytopes.
+    """Integrates homogeneous functions over polytopes.
 
-    This function accepts the polytope in `poly` and the function in `expr`
-    (uni/bi/trivariate polynomials are implemented) and returns
-    the exact integral of `expr` over `poly`.
+    This function accepts the polytope in `poly` (currently only polygons are
+    implemented) and the function in `expr` (currently only
+    univariate/bivariate polynomials are implemented) and returns the exact
+    integral of `expr` over `poly`.
     Parameters
     ==========
     poly : The input Polygon.
     expr : The input polynomial.
 
     Optional Parameters:
-    --------------------
-    clockwise : Binary value to sort input points of the 2-Polytope clockwise.
+    clockwise : Binary value to sort input points of the polygon clockwise.
     max_degree : The maximum degree of any monomial of the input polynomial.
     Examples
     ========
@@ -52,222 +53,53 @@ def polytope_integrate(poly, expr, **kwargs):
     clockwise = kwargs.get('clockwise', False)
     max_degree = kwargs.get('max_degree', None)
 
-    if clockwise is True:
-        if isinstance(poly, Polygon):
-            poly = point_sort(poly)
-        else:
-            raise TypeError("clockwise=True works for only 2-Polytope"
-                            "V-representation input")
+    if clockwise is True and isinstance(poly, Polygon):
+        poly = clockwise_sort(poly)
 
     expr = S(expr)
 
     if isinstance(poly, Polygon):
-        # For Vertex Representation(2D case)
+        # For Vertex Representation
         hp_params = hyperplane_parameters(poly)
         facets = poly.sides
-    elif len(poly[0]) == 2:
-        # For Hyperplane Representation(2D case)
-        plen = len(poly)
-        if len(poly[0][0]) == 2:
-            intersections = [intersection(poly[(i - 1) % plen], poly[i],
-                                          "plane2D")
-                             for i in range(0, plen)]
-            hp_params = poly
-            lints = len(intersections)
-            facets = [Segment2D(intersections[i],
-                                intersections[(i + 1) % lints])
-                      for i in range(0, lints)]
-        else:
-            raise NotImplementedError("Integration for H-representation 3D"
-                                      "case not implemented yet.")
     else:
-        # For Vertex Representation(3D case)
-        vertices = poly[0]
-        facets = poly[1:]
-        hp_params = hyperplane_parameters(facets, vertices)
-        return main_integrate3d(expr, facets, vertices, hp_params)
+        # For Hyperplane Representation
+        plen = len(poly)
+        intersections = [intersection(poly[(i - 1) % plen], poly[i])
+                         for i in range(0, plen)]
+        hp_params = poly
+        lints = len(intersections)
+        facets = [Segment2D(intersections[i], intersections[(i + 1) % lints])
+                  for i in range(0, lints)]
 
     if max_degree is not None:
         result = {}
         if not isinstance(expr, list):
             raise TypeError('Input polynomials must be list of expressions')
         result_dict = main_integrate(0, facets, hp_params, max_degree)
-        for poly in expr:
-            if poly not in result:
-                if poly is S.Zero:
+        for polys in expr:
+            if polys not in result:
+                if polys is S.Zero:
                     result[S.Zero] = S.Zero
                     continue
                 integral_value = S.Zero
-                monoms = decompose(poly, separate=True)
+                monoms = decompose(polys, separate=True)
                 for monom in monoms:
                     if monom.is_number:
                         integral_value += result_dict[1] * monom
                     else:
                         coeff = LC(monom)
                         integral_value += result_dict[monom / coeff] * coeff
-                result[poly] = integral_value
+                result[polys] = integral_value
         return result
 
     return main_integrate(expr, facets, hp_params)
 
 
-def main_integrate3d(expr, facets, vertices, hp_params):
-    """Function to translate the problem of integrating uni/bi/tri-variate
-    polynomials over a 3-Polytope to integrating over its faces.
-    This is done using Generalized Stokes's Theorem and Euler's Theorem.
-
-    Parameters
-    ===========
-    expr : The input polynomial
-    facets : Faces of the 3-Polytope(expressed as indices of `vertices`)
-    vertices : Vertices that constitute the Polytope
-    hp_params : Hyperplane Parameters of the facets
-
-    >>> from sympy.abc import x, y
-    >>> from sympy.integrals.intpoly import main_integrate3d, \
-    hyperplane_parameters
-    >>> cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\
-                (5, 0, 5), (5, 5, 0), (5, 5, 5)],\
-                [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0],\
-                [3, 1, 0, 2], [0, 4, 6, 2]]
-    >>> vertices = cube[0]
-    >>> faces = cube[1:]
-    >>> hp_params = hyperplane_parameters(faces, vertices)
-    >>> main_integrate3d(1, faces, vertices, hp_params)
-    -125
-    """
-    dims = (x, y, z)
-    dim_length = len(dims)
-    integral_value = S.Zero
-    polynomials = decompose(expr)
-    for deg in polynomials:
-        poly_contribute = S.Zero
-        facet_count = 0
-        for i, facet in enumerate(facets):
-            hp = hp_params[i]
-            if hp[1] == S.Zero:
-                continue
-            pi = polygon_integrate(facet, hp, i, facets, vertices, expr, deg)
-            poly_contribute += pi *\
-                (hp[1] / norm(tuple(hp[0])))
-            facet_count += 1
-        poly_contribute /= (dim_length + deg)
-        integral_value += poly_contribute
-    return integral_value
-
-
-def polygon_integrate(facet, hp_param, index, facets, vertices, expr, degree):
-    """Helper function to integrate the input uni/bi/trivariate polynomial
-    over a certain face of the 3-Polytope.
-
-    Parameters
-    ===========
-    facet : Particular face of the 3-Polytope over which `expr` is integrated
-    index : The index of `facet` in `facets`
-    facets : Faces of the 3-Polytope(expressed as indices of `vertices`)
-    vertices : Vertices that constitute the facet
-    expr : The input polynomial
-    degree : Degree of `expr`
-
-    >>> from sympy.abc import x, y
-    >>> from sympy.integrals.intpoly import polygon_integrate
-    >>> cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\
-                 (5, 0, 5), (5, 5, 0), (5, 5, 5)],\
-                 [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0],\
-                 [3, 1, 0, 2], [0, 4, 6, 2]]
-    >>> facet = cube[1]
-    >>> facets = cube[1:]
-    >>> vertices = cube[0]
-    >>> polygon_integrate(facet, [(0, 1, 0), 5], 0, facets, vertices, 1, 0)
-    -25
-    """
-
-    if expr == S.Zero:
-        return S.Zero
-    result = S.Zero
-    m = len(facets)
-    x0 = vertices[facet[0]]
-    for i in range(len(facet)):
-        side = (facet[i], facet[(i + 1) % len(facet)])
-        for j in range(m):
-            if j != index and len(set(side).intersection(set(facets[j]))) == 2:
-                side = (vertices[side[0]], vertices[side[1]])
-                result += distance_to_side(x0, side, hp_param[0]) *\
-                    lineseg_integrate(facet, i, side, expr, degree)
-
-    expr = diff(expr, x) * x0[0] + diff(expr, y) * x0[1] +\
-        diff(expr, z) * x0[2]
-    result += polygon_integrate(facet, hp_param, index, facets, vertices,
-                                expr, degree - 1)
-    result /= (degree + 2)
-    return result
-
-
-def distance_to_side(point, line_seg, A):
-    """Helper function to compute the signed distance between given 3D point
-    and a line segment.
-
-    Parameters
-    ===========
-    point : 3D Point
-    line_seg : Line Segment
-
-    >>> from sympy.integrals.intpoly import distance_to_side
-    >>> point = (0, 0, 0)
-    >>> distance_to_side(point, [(0, 0, 1), (0, 1, 0)], (1, 0, 0))
-    -sqrt(2)/2
-    """
-    x1, x2 = line_seg
-    rev_normal = [-1 * S(i)/norm(A) for i in A]
-    vector = [x2[i] - x1[i] for i in range(0, 3)]
-    vector = [vector[i]/norm(vector) for i in range(0, 3)]
-
-    n_side = cross_product((0, 0, 0), rev_normal, vector)
-    vectorx0 = [line_seg[0][i] - point[i] for i in range(0, 3)]
-    dot_product = sum([vectorx0[i] * n_side[i] for i in range(0, 3)])
-
-    return dot_product
-
-
-def lineseg_integrate(polygon, index, line_seg, expr, degree):
-    """Helper function to compute the line integral of `expr` over `line_seg`
-
-    Parameters
-    ===========
-    polygon : Face of a 3-Polytope
-    index : index of line_seg in polygon
-    line_seg : Line Segment
-
-    >>> from sympy.integrals.intpoly import lineseg_integrate
-    >>> polygon = [(0, 5, 0), (5, 5, 0), (5, 5, 5), (0, 5, 5)]
-    >>> line_seg = [(0, 5, 0), (5, 5, 0)]
-    >>> lineseg_integrate(polygon, 0, line_seg, 1, 0)
-    5
-    """
-    if expr == S.Zero:
-        return S.Zero
-    result = S.Zero
-    x0 = line_seg[0]
-    distance = norm(tuple([line_seg[1][i] - line_seg[0][i] for i in
-                           range(3)]))
-    if isinstance(expr, Expr):
-        expr_dict = {x: line_seg[1][0],
-                     y: line_seg[1][1],
-                     z: line_seg[1][2]}
-        result += distance * expr.subs(expr_dict)
-    else:
-        result += distance * expr
-    expr = diff(expr, x) * x0[0] + diff(expr, y) * x0[1] +\
-        diff(expr, z) * x0[2]
-    result += lineseg_integrate(polygon, index, line_seg, expr, degree - 1)
-    result /= (degree + 1)
-    return result
-
-
 def main_integrate(expr, facets, hp_params, max_degree=None):
     """Function to translate the problem of integrating univariate/bivariate
-    polynomials over a 2-Polytope to integrating over its boundary facets.
-    This is done using Generalized Stokes's Theorem and Euler's Theorem.
+    polynomials over a 2-Polytope to integrating over it's boundary facets.
+    This is done using Generalized Stokes Theorem and Euler Theorem.
 
     Parameters
     ===========
@@ -276,7 +108,6 @@ def main_integrate(expr, facets, hp_params, max_degree=None):
     hp_params : Hyperplane Parameters of the facets
 
     Optional Parameters:
-    --------------------
     max_degree : The maximum degree of any monomial of the input polynomial.
 
     >>> from sympy.abc import x, y
@@ -418,7 +249,7 @@ def left_integral(m, index, facets, x0, expr, gens):
     for j in range(0, m):
         intersect = ()
         if j == (index - 1) % m or j == (index + 1) % m:
-            intersect = intersection(facets[index], facets[j], "segment2D")
+            intersect = intersection(facets[index], facets[j])
         if intersect:
             distance_origin = norm(tuple(map(lambda x, y: x - y,
                                              intersect, x0)))
@@ -442,7 +273,7 @@ def integration_reduction_dynamic(facets, index, a, b, expr,
                                   x0, monomial_values, monom_index):
     """The same integration_reduction function which uses a dynamic
     programming approach to compute terms by using the values of the integral
-    of previously computed terms.
+    the gradient of previous terms.
 
     Parameters
     ===========
@@ -482,6 +313,8 @@ def integration_reduction_dynamic(facets, index, a, b, expr,
         return expr
 
     if not expr.is_number:
+        a, b = (S(a[0]), S(a[1])), S(b)
+
         x_index = monom_index - max_y_degree + \
             x_degree - 2 if x_degree >= 1 else 0
         y_index = monom_index - 1 if y_degree >= 1 else 0
@@ -497,8 +330,8 @@ def integration_reduction_dynamic(facets, index, a, b, expr,
 
 
 def gradient_terms(binomial_power=0):
-    """Returns a list of all the possible monomials between
-    0 and y**binomial_power
+    """Returns a list of all the possible
+    monomials between 0 and y**binomial_power
 
     Parameters
     ===========
@@ -521,7 +354,7 @@ def gradient_terms(binomial_power=0):
     return terms
 
 
-def hyperplane_parameters(poly, vertices=None):
+def hyperplane_parameters(poly):
     """A helper function to return the hyperplane parameters
     of which the facets of the polygon are a part of.
     Currently works for only 2-Polytopes.
@@ -529,9 +362,6 @@ def hyperplane_parameters(poly, vertices=None):
     ==========
     poly : The input Polygon
 
-    Optional Parameters
-    ----------------------
-    vertices :  Vertex indices of faces of 3-Polytope
     Examples
     ========
     >>> from sympy.geometry.point import Point
@@ -540,52 +370,27 @@ def hyperplane_parameters(poly, vertices=None):
     >>> hyperplane_parameters(Polygon(Point(0, 3), Point(5, 3), Point(1, 1)))
     [((0, 1), 3), ((1, -2), -1), ((-2, -1), -3)]
     """
-    if isinstance(poly, Polygon):
-        vertices = list(poly.vertices) + [poly.vertices[0]]  # Close the polygon
-        params = [None] * (len(vertices) - 1)
+    vertices = list(poly.vertices) + [poly.vertices[0]]  # Close the polygon.
+    params = [None] * (len(vertices) - 1)
+    for i in range(len(vertices) - 1):
+        v1 = vertices[i]
+        v2 = vertices[i + 1]
 
-        for i in range(len(vertices) - 1):
-            v1 = vertices[i]
-            v2 = vertices[i + 1]
+        a1 = v1[1] - v2[1]
+        a2 = v2[0] - v1[0]
+        b = v2[0] * v1[1] - v2[1] * v1[0]
 
-            a1 = v1[1] - v2[1]
-            a2 = v2[0] - v1[0]
-            b = v2[0] * v1[1] - v2[1] * v1[0]
+        factor = gcd_list([a1, a2, b])
 
-            factor = gcd_list([a1, a2, b])
+        b = S(b)/factor
+        a = (S(a1)/factor, S(a2)/factor)
+        params[i] = (a, b)
 
-            b = S(b) / factor
-            a = (S(a1) / factor, S(a2) / factor)
-            params[i] = (a, b)
-    else:
-        params = [None] * len(poly)
-        for i, polygon in enumerate(poly):
-            v1, v2, v3 = [vertices[vertex] for vertex in polygon[:3]]
-            normal = cross_product(v1, v2, v3)
-            b = sum([normal[j] * v1[j] for j in range(0, 3)])
-            fac = gcd_list(normal)
-            if fac is S.Zero:
-                fac = 1
-            normal = [j / fac for j in normal]
-            b = b / fac
-            params[i] = (normal, b)
     return params
 
 
-def cross_product(v1, v2, v3):
-    """Returns the cross-product of vectors (v2 - v1) and (v3 - v1)
-    That is : (v2 - v1) X (v3 - v1)
-    """
-    v2 = [v2[j] - v1[j] for j in range(0, 3)]
-    v3 = [v3[j] - v1[j] for j in range(0, 3)]
-    return [v3[2] * v2[1] - v3[1] * v2[2],
-            v3[0] * v2[2] - v3[2] * v2[0],
-            v3[1] * v2[0] - v3[0] * v2[1]]
-
-
 def best_origin(a, b, lineseg, expr):
-    """Helper method for polytope_integrate. Currently not used in the main
-    algorithm.
+    """Helper method for polytope_integrate.
     Returns a point on the lineseg whose vector inner product with the
     divergence of `expr` yields an expression with the least maximum
     total power.
@@ -626,7 +431,6 @@ def best_origin(a, b, lineseg, expr):
     (0, 3.0)
     """
     a1, b1 = lineseg.points[0]
-
     def x_axis_cut(ls):
         """Returns the point where the input line segment
         intersects the x-axis.
@@ -741,7 +545,7 @@ def decompose(expr, separate=False):
     expr : Polynomial(SymPy expression)
 
     Optional Parameters :
-    ---------------------
+
     separate : If True then simply return a list of the constituent monomials
                If not then break up the polynomial into constituent homogeneous
                polynomials.
@@ -793,80 +597,55 @@ def decompose(expr, separate=False):
     return poly_dict
 
 
-def point_sort(poly, normal=None, clockwise=True):
-    """Returns the same polygon with points sorted in clockwise or
-    anti-clockwise order.
+def clockwise_sort(poly):
+    """Returns the same polygon with points sorted in clockwise order.
 
     Note that it's necessary for input points to be sorted in some order
-    (clockwise or anti-clockwise) for the integration algorithm to work.
-    As a convention algorithm has been implemented keeping clockwise
-    orientation in mind.
+    (clockwise or anti-clockwise) for the algorithm to work. As a convention
+    algorithm has been implemented keeping clockwise orientation in mind.
 
     Parameters
     ==========
-    poly: 2D or 3D Polygon
-
-    Optional Parameters:
-    ---------------------
-    normal : The normal of the plane which the 3-Polytope is a part of.
-    clockwise : Returns points sorted in clockwise order if True and
-    anti-clockwise if False.
+    poly: 2-Polytope
 
     Examples
     ========
-    >>> from sympy.integrals.intpoly import point_sort
+    >>> from sympy.integrals.intpoly import clockwise_sort
     >>> from sympy.geometry.point import Point
-    >>> point_sort([Point(0, 0), Point(1, 0), Point(1, 1)])
-    [Point2D(1, 1), Point2D(1, 0), Point2D(0, 0)]
+    >>> from sympy.geometry.polygon import Polygon
+    >>> clockwise_sort(Polygon(Point(0, 0), Point(1, 0), Point(1, 1)))
+    Triangle(Point2D(1, 1), Point2D(1, 0), Point2D(0, 0))
+
     """
-    n = len(poly)
-    if n < 2:
-        return poly
-
-    order = S(1) if clockwise else S(-1)
-    dim = len(poly[0])
-    if dim == 2:
-        center = Point(sum(map(lambda vertex: vertex.x, poly)) / n,
-                       sum(map(lambda vertex: vertex.y, poly)) / n)
-    else:
-        center = Point(sum(map(lambda vertex: vertex.x, poly)) / n,
-                       sum(map(lambda vertex: vertex.y, poly)) / n,
-                       sum(map(lambda vertex: vertex.z, poly)) / n)
+    n = len(poly.vertices)
+    vertices = list(poly.vertices)
+    center = Point(sum(map(lambda vertex: vertex.x, poly.vertices)) / n,
+                   sum(map(lambda vertex: vertex.y, poly.vertices)) / n)
 
-    def compare(a, b):
+    def compareTo(a, b):
         if a.x - center.x >= S.Zero and b.x - center.x < S.Zero:
-            return -order
+            return S(-1)
         elif a.x - center.x < S.Zero and b.x - center.x >= S.Zero:
-            return order
+            return S(1)
         elif a.x - center.x == S.Zero and b.x - center.x == S.Zero:
             if a.y - center.y >= S.Zero or b.y - center.y >= S.Zero:
-                return -order if a.y > b.y else order
-            return -order if b.y > a.y else order
+                return S(-1) if a.y > b.y else S(1)
+            return S(-1) if b.y > a.y else S(1)
 
         det = (a.x - center.x) * (b.y - center.y) -\
               (b.x - center.x) * (a.y - center.y)
         if det < S.Zero:
-            return -order
+            return S(-1)
         elif det > S.Zero:
-            return order
+            return S(1)
 
         first = (a.x - center.x) * (a.x - center.x) +\
                 (a.y - center.y) * (a.y - center.y)
         second = (b.x - center.x) * (b.x - center.x) +\
                  (b.y - center.y) * (b.y - center.y)
-        return -order if first > second else order
-
-    def compare3d(a, b):
-        det = cross_product(center, a, b)
-        dot_product = sum([det[i] * normal[i] for i in range(0, 3)])
-        if dot_product < S.Zero:
-            return -order
-        elif dot_product > S.Zero:
-            return order
+        return S(-1) if first > second else S(1)
 
-    if dim == 2:
-        return sorted(poly, key=cmp_to_key(compare))
-    return sorted(poly, key=cmp_to_key(compare3d))
+    return Polygon(*sorted(vertices, key=cmp_to_key(compareTo)))
 
 
 def norm(point):
@@ -874,7 +653,7 @@ def norm(point):
 
     Parameters
     ==========
-    point: This denotes a point in the dimension_al spac_e.
+    point: This denotes a point in the dimensional space.
 
     Examples
     ========
@@ -882,31 +661,28 @@ def norm(point):
     >>> from sympy.geometry.point import Point
     >>> norm(Point(2, 7))
     sqrt(53)
+
     """
     half = S(1)/2
-    if isinstance(point, (list, tuple)):
-        return sum([coord ** 2 for coord in point]) ** half
+    if isinstance(point, tuple):
+        return (point[0] ** 2 + point[1] ** 2) ** half
     elif isinstance(point, Point):
-        if isinstance(point, Point2D):
-            return (point.x ** 2 + point.y ** 2) ** half
-        else:
-            return (point.x ** 2 + point.y ** 2 + point.z) ** half
+        return (point.x ** 2 + point.y ** 2) ** half
     elif isinstance(point, dict):
         return sum(i**2 for i in point.values()) ** half
 
 
-def intersection(geom_1, geom_2, intersection_type):
-    """Returns intersection between geometric objects.
-
-    Note that this function is meant for use in integration_reduction and
-    at that point in the calling function the lines denoted by the segments
-    surely intersect within segment boundaries. Coincident lines are taken
-    to be non-intersecting. Also, the hyperplane intersection for 2D case is
-    also implemented.
+def intersection(lineseg_1, lineseg_2):
+    """Returns intersection between lines of which
+    the input line segments are a part of.
+    Note that this function is meant for use in integration_reduction
+    and at that point in the calling function the lines denoted by the
+    segments surely intersect within segment boundaries. Coincident lines
+    are taken to be non-intersecting.
 
     Parameters
     ==========
-    geom_1, geom_2: The input line segments
+    lineseg_1, lineseg_2: The input line segments
 
     Examples
     ========
@@ -915,41 +691,34 @@ def intersection(geom_1, geom_2, intersection_type):
     >>> from sympy.geometry.line import Segment2D
     >>> l1 = Segment2D(Point(1, 1), Point(3, 5))
     >>> l2 = Segment2D(Point(2, 0), Point(2, 5))
-    >>> intersection(l1, l2, "segment2D")
+    >>> intersection(l1, l2)
     (2, 3)
-    >>> p1 = ((-1, 0), 0)
-    >>> p2 = ((0, 1), 1)
-    >>> intersection(p1, p2, "plane2D")
-    (0, 1)
+
     """
-    if intersection_type[:-2] == "segment":
-        if intersection_type == "segment2D":
-            x1, y1 = geom_1.points[0]
-            x2, y2 = geom_1.points[1]
-            x3, y3 = geom_2.points[0]
-            x4, y4 = geom_2.points[1]
-        elif intersection_type == "segment3D":
-            x1, y1, z1 = geom_1.points[0]
-            x2, y2, z2 = geom_1.points[1]
-            x3, y3, z3 = geom_2.points[0]
-            x4, y4, z4 = geom_2.points[1]
-
-        denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)
+    if isinstance(lineseg_1, Segment2D):
+        x1, y1 = lineseg_1.points[0]
+        x2, y2 = lineseg_1.points[1]
+        x3, y3 = lineseg_2.points[0]
+        x4, y4 = lineseg_2.points[1]
+    else:
+        a1x, a1y = S(lineseg_1[0][0]), S(lineseg_1[0][1])
+        a2x, a2y = S(lineseg_2[0][0]), S(lineseg_2[0][1])
+        b1, b2 = S(lineseg_1[1]), S(lineseg_2[1])
+
+        denom = a1x * a2y - a2x * a1y
         if denom:
-            t1 = x1 * y2 - y1 * x2
-            t2 = x3 * y4 - x4 * y3
-            return (S(t1 * (x3 - x4) - t2 * (x1 - x2)) / denom,
-                    S(t1 * (y3 - y4) - t2 * (y1 - y2)) / denom)
-    if intersection_type[:-2] == "plane":
-        if intersection_type == "plane2D":  # Intersection of hyperplanes
-            a1x, a1y = geom_1[0]
-            a2x, a2y = geom_2[0]
-            b1, b2 = S(geom_1[1]), S(geom_2[1])
-
-            denom = a1x * a2y - a2x * a1y
-            if denom:
-                return (S(b1 * a2y - b2 * a1y) / denom,
-                        S(b2 * a1x - b1 * a2x) / denom)
+            return (S(b1 * a2y - b2 * a1y) / denom,
+                    S(b2 * a1x - b1 * a2x) / denom)
+        return ()
+
+    denom = (x1 - x2)*(y3 - y4) - (y1 - y2)*(x3 - x4)
+
+    if denom:
+        t1 = x1*y2 - y1*x2
+        t2 = x3*y4 - x4*y3
+        return(S(t1*(x3 - x4) - t2*(x1 - x2))/denom,
+               S(t1*(y3 - y4) - t2*(y1 - y2))/denom)
+    return ()
 
 
 def is_vertex(ent):
diff --git a/sympy/ntheory/residue_ntheory.py b/sympy/ntheory/residue_ntheory.py
index 0928964977..6a469e8896 100644
--- a/sympy/ntheory/residue_ntheory.py
+++ b/sympy/ntheory/residue_ntheory.py
@@ -72,11 +72,12 @@ def _primitive_root_prime_iter(p):
     >>> list(_primitive_root_prime_iter(19))
     [2, 3, 10, 13, 14, 15]
     """
-    p = as_int(p)
+    # it is assumed that p is an int
     v = [(p - 1) // i for i in factorint(p - 1).keys()]
     a = 2
     while a < p:
         for pw in v:
+            # a TypeError below may indicate that p was not an int
             if pow(a, pw, p) == 1:
                 break
         else:
@@ -626,7 +627,7 @@ def is_nthpow_residue(a, n, m):
     .. [1] P. Hackman "Elementary Number Theory" (2009), page 76
 
     """
-    a, n, m = [as_int(i) for i in (a, n, m)]
+    a, n, m = as_int(a), as_int(n), as_int(m)
     if m <= 0:
         raise ValueError('m must be > 0')
     if n < 0:
@@ -766,8 +767,9 @@ def nthroot_mod(a, n, p, all_roots=False):
     23
     """
     from sympy.core.numbers import igcdex
+    a, n, p = as_int(a), as_int(n), as_int(p)
     if n == 2:
-        return sqrt_mod(a, p , all_roots)
+        return sqrt_mod(a, p, all_roots)
     f = totient(p)
     # see Hackman "Elementary Number Theory" (2009), page 76
     if not is_nthpow_residue(a, n, p):
@@ -817,6 +819,7 @@ def quadratic_residues(p):
     >>> quadratic_residues(7)
     [0, 1, 2, 4]
     """
+    p = as_int(p)
     r = set()
     for i in range(p // 2 + 1):
         r.add(pow(i, 2, p))
@@ -1282,6 +1285,7 @@ def discrete_log(n, a, b, order=None, prime_order=None):
     3
 
     """
+    n, a, b = as_int(n), as_int(a), as_int(b)
     if order is None:
         order = n_order(b, n)
 
diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py
index 7cf950bf29..e68f6595cd 100644
--- a/sympy/printing/pycode.py
+++ b/sympy/printing/pycode.py
@@ -202,10 +202,17 @@ class MpmathPrinter(PythonCodePrinter):
     printmethod = "_mpmathcode"
 
     _kf = dict(chain(
-        _known_functions.items(),
+        PythonCodePrinter._kf.items(),
         [(k, 'mpmath.' + v) for k, v in _known_functions_mpmath.items()]
     ))
 
+    def doprint(self, expr, **kwargs):
+        from sympy.functions import log
+        from sympy.codegen.cfunctions import log2, log1p
+        expr = expr.replace(log2, lambda arg: arg.rewrite(log))
+        expr = expr.replace(log1p, lambda arg: arg.rewrite(log))
+        return super(MpmathPrinter, self).doprint(expr, **kwargs)
+
     def _print_Integer(self, e):
         return '%s(%d)' % (self._module_format('mpmath.mpf'), e)
 
@@ -228,14 +235,6 @@ def _print_lowergamma(self,e): #printer for the lowergamma functioin
         return "{0}({1}, 0, {2})".format(
             self._module_format('mpmath.gammainc'), self._print(e.args[0]), self._print(e.args[1]))
 
-    def _print_log2(self, e):
-        return '{0}({1})/{0}(2)'.format(
-            self._module_format('mpmath.log'), self._print(e.args[0]))
-
-    def _print_log1p(self, e):
-        return '{0}({1}+1)'.format(
-            self._module_format('mpmath.log'), self._print(e.args[0]))
-
 for k in MpmathPrinter._kf:
     setattr(MpmathPrinter, '_print_%s' % k, _print_known_func)
 
diff --git a/sympy/vector/coordsysrect.py b/sympy/vector/coordsysrect.py
index f7b2705c6b..bb56d987d0 100644
--- a/sympy/vector/coordsysrect.py
+++ b/sympy/vector/coordsysrect.py
@@ -40,10 +40,6 @@ def __new__(cls, name, transformation=None, parent=None, location=None,
         name : str
             The name of the new CoordSys3D instance.
 
-        transformation : Lambda, Tuple, str
-            Transformation defined by transformation equations or chooesed
-            from predefined ones.
-
         location : Vector
             The position vector of the new system's origin wrt the parent
             instance.
@@ -139,7 +135,6 @@ def __new__(cls, name, transformation=None, parent=None, location=None,
                 parent
             )
             r, l = transformation
-            l = l._projections
             lambda_lame = CoordSys3D._get_lame_coeff('cartesian')
             lambda_inverse = lambda x,y,z: r.inv()*Matrix(
                 [x-l[0], y-l[1], z-l[2]])
@@ -448,9 +443,9 @@ def transformation_to_parent(self):
         return self._transformation_lambda(*self.base_scalars())
 
     def transformation_from_parent(self):
-        if self._parent is None:
+        if self.parent is None:
             raise ValueError("no parent coordinate system, use `transformation_from_parent_function()`")
-        return self._transformation_from_parent_lambda(*self._parent.base_scalars())
+        return self._transformation_from_parent_lambda(*self.parent.base_scalars())
 
     def transformation_from_parent_function(self):
         return self._transformation_from_parent_lambda
@@ -951,40 +946,6 @@ def orient_new_quaternion(self, name, q0, q1, q2, q3, location=None,
                                vector_names=vector_names,
                                variable_names=variable_names)
 
-    def create_new(self, name, transformation, variable_names=None, vector_names=None):
-        """
-        Returns a CoordSys3D which is connected to self by transformation.
-
-        Parameters
-        ==========
-
-        name : str
-            The name of the new CoordSys3D instance.
-
-        transformation : Lambda, Tuple, str
-            Transformation defined by transformation equations or chooesed
-            from predefined ones.
-
-        vector_names, variable_names : iterable(optional)
-            Iterables of 3 strings each, with custom names for base
-            vectors and base scalars of the new system respectively.
-            Used for simple str printing.
-
-        Examples
-        ========
-
-        >>> from sympy.vector import CoordSys3D
-        >>> a = CoordSys3D('a')
-        >>> b = a.create_new('b', transformation='spherical')
-        >>> b.transformation_to_parent()
-        (b.x*sin(b.y)*cos(b.z), b.x*sin(b.y)*sin(b.z), b.x*cos(b.y))
-        >>> b.transformation_from_parent()
-        (sqrt(a.x**2 + a.y**2 + a.z**2), acos(a.z/sqrt(a.x**2 + a.y**2 + a.z**2)), atan2(a.y, a.x))
-
-        """
-        return CoordSys3D(name, parent=self, transformation=transformation,
-                          variable_names=variable_names, vector_names=vector_names)
-
     def __init__(self, name, location=None, rotation_matrix=None,
                  parent=None, vector_names=None, variable_names=None,
                  latex_vects=None, pretty_vects=None, latex_scalars=None,
diff --git a/sympy/vector/vector.py b/sympy/vector/vector.py
index 59c6fcefa6..130b22f4d1 100755
--- a/sympy/vector/vector.py
+++ b/sympy/vector/vector.py
@@ -233,34 +233,6 @@ def projection(self, other, scalar=False):
         else:
             return self.dot(other) / self.dot(self) * self
 
-    @property
-    def _projections(self):
-        """
-        Returns the components of this vector but the output includes
-        also zero values components.
-
-        Examples
-        ========
-
-        >>> from sympy.vector import CoordSys3D, Vector
-        >>> C = CoordSys3D('C')
-        >>> v1 = 3*C.i + 4*C.j + 5*C.k
-        >>> v1._projections
-        (3, 4, 5)
-        >>> v2 = C.x*C.y*C.z*C.i
-        >>> v2._projections
-        (C.x*C.y*C.z, 0, 0)
-        >>> v3 = Vector.zero
-        >>> v3._projections
-        (0, 0, 0)
-        """
-
-        from sympy.vector.operators import _get_coord_sys_from_expr
-        if isinstance(self, VectorZero):
-            return (S(0), S(0), S(0))
-        base_vec = next(iter(_get_coord_sys_from_expr(self))).base_vectors()
-        return tuple([self.dot(i) for i in base_vec])
-
     def __or__(self, other):
         return self.outer(other)
 


Test patch:
diff --git a/sympy/integrals/tests/test_intpoly.py b/sympy/integrals/tests/test_intpoly.py
index 26c0b2328e..80dee95dca 100644
--- a/sympy/integrals/tests/test_intpoly.py
+++ b/sympy/integrals/tests/test_intpoly.py
@@ -1,6 +1,6 @@
 from __future__ import print_function, division
 
-from sympy import sqrt, Abs
+from sympy import sqrt
 
 from sympy.core import S
 
@@ -10,9 +10,9 @@
 from sympy.geometry.line import Segment2D
 from sympy.geometry.polygon import Polygon
 from sympy.geometry.point import Point
-from sympy.abc import x, y, z
+from sympy.abc import x, y
 
-from sympy.utilities.pytest import XFAIL
+from sympy.utilities.pytest import raises, XFAIL
 
 
 def test_decompose():
@@ -144,326 +144,10 @@ def test_polytope_integrate():
     expr3 = x**10 + x**9*y + x**8*y**2 + x**5*y**5
     polys.extend((expr1, expr2, expr3))
     result_dict = polytope_integrate(tri, polys, max_degree=10)
-    assert result_dict[expr1] == S(615780107)/594
-    assert result_dict[expr2] == S(13062161)/27
-    assert result_dict[expr3] == S(1946257153)/924
+    assert result_dict[expr1] == 615780107/594
+    assert result_dict[expr2] == 13062161/27
+    assert result_dict[expr3] == 1946257153/924
 
-    #  Tests for 3D polytopes
-    cube1 = [[(0, 0, 0), (0, 6, 6), (6, 6, 6), (3, 6, 0),
-              (0, 6, 0), (6, 0, 6), (3, 0, 0), (0, 0, 6)],
-             [1, 2, 3, 4], [3, 2, 5, 6], [1, 7, 5, 2], [0, 6, 5, 7],
-             [1, 4, 0, 7], [0, 4, 3, 6]]
-    assert polytope_integrate(cube1, 1) == S(162)
-
-    #  3D Test cases in Chin et al(2015)
-    cube2 = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),
-             (5, 0, 5), (5, 5, 0), (5, 5, 5)],
-             [3, 7, 6, 2], [1, 5, 7, 3], [5, 4, 6, 7], [0, 4, 5, 1],
-             [2, 0, 1, 3], [2, 6, 4, 0]]
-
-    cube3 = [[(0, 0, 0), (5, 0, 0), (5, 4, 0), (3, 2, 0), (3, 5, 0),
-              (0, 5, 0), (0, 0, 5), (5, 0, 5), (5, 4, 5), (3, 2, 5),
-              (3, 5, 5), (0, 5, 5)],
-             [6, 11, 5, 0], [1, 7, 6, 0], [5, 4, 3, 2, 1, 0], [11, 10, 4, 5],
-             [10, 9, 3, 4], [9, 8, 2, 3], [8, 7, 1, 2], [7, 8, 9, 10, 11, 6]]
-
-    cube4 = [[(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1),
-              (S(1) / 4, S(1) / 4, S(1) / 4)],
-             [0, 2, 1], [1, 3, 0], [4, 2, 3], [4, 3, 1],
-             [0, 1, 2], [2, 4, 1], [0, 3, 2]]
-
-    assert polytope_integrate(cube2, x ** 2 + y ** 2 + x * y + z ** 2) ==\
-           S(15625)/4
-    assert polytope_integrate(cube3, x ** 2 + y ** 2 + x * y + z ** 2) ==\
-           S(33835) / 12
-    assert polytope_integrate(cube4, x ** 2 + y ** 2 + x * y + z ** 2) ==\
-           S(37) / 960
-
-    #  Test cases from Mathematica's PolyhedronData library
-    octahedron = [[(S(-1) / sqrt(2), 0, 0), (0, S(1) / sqrt(2), 0),
-                   (0, 0, S(-1) / sqrt(2)), (0, 0, S(1) / sqrt(2)),
-                   (0, S(-1) / sqrt(2), 0), (S(1) / sqrt(2), 0, 0)],
-                  [3, 4, 5], [3, 5, 1], [3, 1, 0], [3, 0, 4], [4, 0, 2],
-                  [4, 2, 5], [2, 0, 1], [5, 2, 1]]
-
-    assert polytope_integrate(octahedron, 1) == sqrt(2) / 3
-
-    great_stellated_dodecahedron =\
-        [[(-0.32491969623290634095, 0, 0.42532540417601993887),
-          (0.32491969623290634095, 0, -0.42532540417601993887),
-          (-0.52573111211913359231, 0, 0.10040570794311363956),
-          (0.52573111211913359231, 0, -0.10040570794311363956),
-          (-0.10040570794311363956, -0.3090169943749474241, 0.42532540417601993887),
-          (-0.10040570794311363956, 0.30901699437494742410, 0.42532540417601993887),
-          (0.10040570794311363956, -0.3090169943749474241, -0.42532540417601993887),
-          (0.10040570794311363956, 0.30901699437494742410, -0.42532540417601993887),
-          (-0.16245984811645317047, -0.5, 0.10040570794311363956),
-          (-0.16245984811645317047,  0.5, 0.10040570794311363956),
-          (0.16245984811645317047,  -0.5, -0.10040570794311363956),
-          (0.16245984811645317047,   0.5, -0.10040570794311363956),
-          (-0.42532540417601993887, -0.3090169943749474241, -0.10040570794311363956),
-          (-0.42532540417601993887, 0.30901699437494742410, -0.10040570794311363956),
-          (-0.26286555605956679615, 0.1909830056250525759, -0.42532540417601993887),
-          (-0.26286555605956679615, -0.1909830056250525759, -0.42532540417601993887),
-          (0.26286555605956679615, 0.1909830056250525759, 0.42532540417601993887),
-          (0.26286555605956679615, -0.1909830056250525759, 0.42532540417601993887),
-          (0.42532540417601993887, -0.3090169943749474241, 0.10040570794311363956),
-          (0.42532540417601993887, 0.30901699437494742410, 0.10040570794311363956)],
-         [12, 3, 0, 6, 16], [17, 7, 0, 3, 13],
-         [9, 6, 0, 7, 8], [18, 2, 1, 4, 14],
-         [15, 5, 1, 2, 19], [11, 4, 1, 5, 10],
-         [8, 19, 2, 18, 9], [10, 13, 3, 12, 11],
-         [16, 14, 4, 11, 12], [13, 10, 5, 15, 17],
-         [14, 16, 6, 9, 18], [19, 8, 7, 17, 15]]
-    #  Actual volume is : 0.163118960624632
-    assert Abs(polytope_integrate(great_stellated_dodecahedron, 1) -\
-        0.163118960624632) < 1e-12
-
-    expr = x **2 + y ** 2 + z ** 2
-    octahedron_five_compound = [[(0, -0.7071067811865475244, 0),
-                                 (0, 0.70710678118654752440, 0),
-                                 (0.1148764602736805918,
-                                  -0.35355339059327376220, -0.60150095500754567366),
-                                 (0.1148764602736805918, 0.35355339059327376220,
-                                     -0.60150095500754567366),
-                                 (0.18587401723009224507,
-                                  -0.57206140281768429760, 0.37174803446018449013),
-                                 (0.18587401723009224507,  0.57206140281768429760,
-                                  0.37174803446018449013),
-                                 (0.30075047750377283683, -0.21850801222441053540,
-                                  0.60150095500754567366),
-                                 (0.30075047750377283683, 0.21850801222441053540,
-                                  0.60150095500754567366),
-                                 (0.48662449473386508189, -0.35355339059327376220,
-                                  -0.37174803446018449013),
-                                 (0.48662449473386508189, 0.35355339059327376220,
-                                  -0.37174803446018449013),
-                                 (-0.60150095500754567366, 0, -0.37174803446018449013),
-                                 (-0.30075047750377283683, -0.21850801222441053540,
-                                  -0.60150095500754567366),
-                                 (-0.30075047750377283683, 0.21850801222441053540,
-                                  -0.60150095500754567366),
-                                 (0.60150095500754567366, 0, 0.37174803446018449013),
-                                 (0.4156269377774534286, -0.57206140281768429760, 0),
-                                 (0.4156269377774534286, 0.57206140281768429760, 0),
-                                 (0.37174803446018449013, 0, -0.60150095500754567366),
-                                 (-0.4156269377774534286, -0.57206140281768429760, 0),
-                                 (-0.4156269377774534286, 0.57206140281768429760, 0),
-                                 (-0.67249851196395732696, -0.21850801222441053540, 0),
-                                 (-0.67249851196395732696, 0.21850801222441053540, 0),
-                                 (0.67249851196395732696, -0.21850801222441053540, 0),
-                                 (0.67249851196395732696, 0.21850801222441053540, 0),
-                                 (-0.37174803446018449013, 0, 0.60150095500754567366),
-                                 (-0.48662449473386508189, -0.35355339059327376220,
-                                 0.37174803446018449013),
-                                 (-0.48662449473386508189, 0.35355339059327376220,
-                                  0.37174803446018449013),
-                                 (-0.18587401723009224507, -0.57206140281768429760,
-                                  -0.37174803446018449013),
-                                 (-0.18587401723009224507, 0.57206140281768429760,
-                                  -0.37174803446018449013),
-                                 (-0.11487646027368059176, -0.35355339059327376220,
-                                  0.60150095500754567366),
-                                 (-0.11487646027368059176, 0.35355339059327376220,
-                                 0.60150095500754567366)],
-                                 [0, 10, 16], [23, 10, 0], [16, 13, 0],
-                                 [0, 13, 23], [16, 10, 1], [1, 10, 23],
-                                 [1, 13, 16], [23, 13, 1], [2, 4, 19],
-                                 [22, 4, 2], [2, 19, 27], [27, 22, 2],
-                                 [20, 5, 3], [3, 5, 21], [26, 20, 3],
-                                 [3, 21, 26], [29, 19, 4], [4, 22, 29],
-                                 [5, 20, 28], [28, 21, 5], [6, 8, 15],
-                                 [17, 8, 6], [6, 15, 25], [25, 17, 6],
-                                 [14, 9, 7], [7, 9, 18], [24, 14, 7],
-                                 [7, 18, 24], [8, 12, 15], [17, 12, 8],
-                                 [14, 11, 9], [9, 11, 18], [11, 14, 24],
-                                 [24, 18, 11], [25, 15, 12], [12, 17, 25],
-                                 [29, 27, 19], [20, 26, 28], [28, 26, 21],
-                                 [22, 27, 29]]
-    assert Abs(polytope_integrate(octahedron_five_compound, expr)) - 0.353553\
-        < 1e-6
-
-    cube_five_compound = [[(-0.1624598481164531631, -0.5, -0.6881909602355867691),
-                           (-0.1624598481164531631, 0.5, -0.6881909602355867691),
-                           (0.1624598481164531631, -0.5, 0.68819096023558676910),
-                           (0.1624598481164531631, 0.5, 0.68819096023558676910),
-                          (-0.52573111211913359231, 0, -0.6881909602355867691),
-                          (0.52573111211913359231, 0, 0.68819096023558676910),
-                          (-0.26286555605956679615, -0.8090169943749474241,
-                           -0.1624598481164531631),
-                          (-0.26286555605956679615, 0.8090169943749474241,
-                           -0.1624598481164531631),
-                          (0.26286555605956680301, -0.8090169943749474241,
-                           0.1624598481164531631),
-                          (0.26286555605956680301, 0.8090169943749474241,
-                           0.1624598481164531631),
-                          (-0.42532540417601993887, -0.3090169943749474241,
-                           0.68819096023558676910),
-                          (-0.42532540417601993887, 0.30901699437494742410,
-                           0.68819096023558676910),
-                          (0.42532540417601996609, -0.3090169943749474241,
-                           -0.6881909602355867691),
-                          (0.42532540417601996609, 0.30901699437494742410,
-                           -0.6881909602355867691),
-                          (-0.6881909602355867691, -0.5, 0.1624598481164531631),
-                          (-0.6881909602355867691, 0.5,  0.1624598481164531631),
-                          (0.68819096023558676910, -0.5, -0.1624598481164531631),
-                          (0.68819096023558676910, 0.5, -0.1624598481164531631),
-                          (-0.85065080835203998877, 0, -0.1624598481164531631),
-                          (0.85065080835203993218, 0, 0.1624598481164531631)],
-                          [18, 10, 3, 7], [13, 19, 8, 0], [18, 0, 8, 10],
-                          [3, 19, 13, 7], [18, 7, 13, 0], [8, 19, 3, 10],
-                          [6, 2, 11, 18], [1, 9, 19, 12], [11, 9, 1, 18],
-                          [6, 12, 19, 2], [1, 12, 6, 18], [11, 2, 19, 9],
-                          [4, 14, 11, 7], [17, 5, 8, 12], [4, 12, 8, 14],
-                          [11, 5, 17, 7], [4, 7, 17, 12], [8, 5, 11, 14],
-                          [6, 10, 15, 4], [13, 9, 5, 16], [15, 9, 13, 4],
-                          [6, 16, 5, 10], [13, 16, 6, 4], [15, 10, 5, 9],
-                          [14, 15, 1, 0], [16, 17, 3, 2], [14, 2, 3, 15],
-                          [1, 17, 16, 0], [14, 0, 16, 2], [3, 17, 1, 15]]
-    assert Abs(polytope_integrate(cube_five_compound, expr) - 1.25) < 1e-12
-
-    echidnahedron = [[(0, 0, -2.4898982848827801995),
-                      (0, 0, 2.4898982848827802734),
-                      (0, -4.2360679774997896964, -2.4898982848827801995),
-                      (0, -4.2360679774997896964, 2.4898982848827802734),
-                      (0, 4.2360679774997896964, -2.4898982848827801995),
-                      (0, 4.2360679774997896964, 2.4898982848827802734),
-                      (-4.0287400534704067567, -1.3090169943749474241, -2.4898982848827801995),
-                      (-4.0287400534704067567, -1.3090169943749474241, 2.4898982848827802734),
-                      (-4.0287400534704067567, 1.3090169943749474241, -2.4898982848827801995),
-                      (-4.0287400534704067567, 1.3090169943749474241, 2.4898982848827802734),
-                      (4.0287400534704069747, -1.3090169943749474241, -2.4898982848827801995),
-                      (4.0287400534704069747, -1.3090169943749474241, 2.4898982848827802734),
-                      (4.0287400534704069747, 1.3090169943749474241, -2.4898982848827801995),
-                      (4.0287400534704069747, 1.3090169943749474241, 2.4898982848827802734),
-                      (-2.4898982848827801995, -3.4270509831248422723, -2.4898982848827801995),
-                      (-2.4898982848827801995, -3.4270509831248422723, 2.4898982848827802734),
-                      (-2.4898982848827801995, 3.4270509831248422723, -2.4898982848827801995),
-                      (-2.4898982848827801995, 3.4270509831248422723, 2.4898982848827802734),
-                      (2.4898982848827802734, -3.4270509831248422723, -2.4898982848827801995),
-                      (2.4898982848827802734, -3.4270509831248422723, 2.4898982848827802734),
-                      (2.4898982848827802734, 3.4270509831248422723, -2.4898982848827801995),
-                      (2.4898982848827802734, 3.4270509831248422723, 2.4898982848827802734),
-                      (-4.7169310137059934362, -0.8090169943749474241, -1.1135163644116066184),
-                      (-4.7169310137059934362, 0.8090169943749474241, -1.1135163644116066184),
-                      (4.7169310137059937438, -0.8090169943749474241, 1.11351636441160673519),
-                      (4.7169310137059937438, 0.8090169943749474241, 1.11351636441160673519),
-                      (-4.2916056095299737777, -2.1180339887498948482, 1.11351636441160673519),
-                      (-4.2916056095299737777, 2.1180339887498948482, 1.11351636441160673519),
-                      (4.2916056095299737777, -2.1180339887498948482, -1.1135163644116066184),
-                      (4.2916056095299737777, 2.1180339887498948482, -1.1135163644116066184),
-                      (-3.6034146492943870399, 0, -3.3405490932348205213),
-                      (3.6034146492943870399, 0, 3.3405490932348202056),
-                      (-3.3405490932348205213, -3.4270509831248422723, 1.11351636441160673519),
-                      (-3.3405490932348205213, 3.4270509831248422723, 1.11351636441160673519),
-                      (3.3405490932348202056, -3.4270509831248422723, -1.1135163644116066184),
-                      (3.3405490932348202056, 3.4270509831248422723, -1.1135163644116066184),
-                      (-2.9152236890588002395, -2.1180339887498948482, 3.3405490932348202056),
-                      (-2.9152236890588002395, 2.1180339887498948482, 3.3405490932348202056),
-                      (2.9152236890588002395, -2.1180339887498948482, -3.3405490932348205213),
-                      (2.9152236890588002395, 2.1180339887498948482, -3.3405490932348205213),
-                      (-2.2270327288232132368, 0, -1.1135163644116066184),
-                      (-2.2270327288232132368, -4.2360679774997896964, -1.1135163644116066184),
-                      (-2.2270327288232132368, 4.2360679774997896964, -1.1135163644116066184),
-                      (2.2270327288232134704, 0, 1.11351636441160673519),
-                      (2.2270327288232134704, -4.2360679774997896964, 1.11351636441160673519),
-                      (2.2270327288232134704, 4.2360679774997896964, 1.11351636441160673519),
-                      (-1.8017073246471935200, -1.3090169943749474241, 1.11351636441160673519),
-                      (-1.8017073246471935200, 1.3090169943749474241, 1.11351636441160673519),
-                      (1.8017073246471935043, -1.3090169943749474241, -1.1135163644116066184),
-                      (1.8017073246471935043, 1.3090169943749474241, -1.1135163644116066184),
-                      (-1.3763819204711735382, 0, -4.7169310137059934362),
-                      (-1.3763819204711735382, 0, 0.26286555605956679615),
-                      (1.37638192047117353821, 0, 4.7169310137059937438),
-                      (1.37638192047117353821, 0, -0.26286555605956679615),
-                      (-1.1135163644116066184, -3.4270509831248422723, -3.3405490932348205213),
-                      (-1.1135163644116066184, -0.8090169943749474241, 4.7169310137059937438),
-                      (-1.1135163644116066184, -0.8090169943749474241, -0.26286555605956679615),
-                      (-1.1135163644116066184, 0.8090169943749474241, 4.7169310137059937438),
-                      (-1.1135163644116066184, 0.8090169943749474241, -0.26286555605956679615),
-                      (-1.1135163644116066184, 3.4270509831248422723, -3.3405490932348205213),
-                      (1.11351636441160673519, -3.4270509831248422723, 3.3405490932348202056),
-                      (1.11351636441160673519, -0.8090169943749474241, -4.7169310137059934362),
-                      (1.11351636441160673519, -0.8090169943749474241, 0.26286555605956679615),
-                      (1.11351636441160673519, 0.8090169943749474241, -4.7169310137059934362),
-                      (1.11351636441160673519, 0.8090169943749474241, 0.26286555605956679615),
-                      (1.11351636441160673519, 3.4270509831248422723, 3.3405490932348202056),
-                      (-0.85065080835203998877, 0, 1.11351636441160673519),
-                      (0.85065080835203993218, 0, -1.1135163644116066184),
-                      (-0.6881909602355867691, -0.5, -1.1135163644116066184),
-                      (-0.6881909602355867691, 0.5, -1.1135163644116066184),
-                      (-0.6881909602355867691, -4.7360679774997896964, -1.1135163644116066184),
-                      (-0.6881909602355867691, -2.1180339887498948482, -1.1135163644116066184),
-                      (-0.6881909602355867691, 2.1180339887498948482, -1.1135163644116066184),
-                      (-0.6881909602355867691, 4.7360679774997896964, -1.1135163644116066184),
-                      (0.68819096023558676910, -0.5, 1.11351636441160673519),
-                      (0.68819096023558676910, 0.5, 1.11351636441160673519),
-                      (0.68819096023558676910, -4.7360679774997896964, 1.11351636441160673519),
-                      (0.68819096023558676910, -2.1180339887498948482, 1.11351636441160673519),
-                      (0.68819096023558676910, 2.1180339887498948482, 1.11351636441160673519),
-                      (0.68819096023558676910, 4.7360679774997896964, 1.11351636441160673519),
-                      (-0.42532540417601993887, -1.3090169943749474241, -4.7169310137059934362),
-                      (-0.42532540417601993887, -1.3090169943749474241, 0.26286555605956679615),
-                      (-0.42532540417601993887, 1.3090169943749474241, -4.7169310137059934362),
-                      (-0.42532540417601993887, 1.3090169943749474241, 0.26286555605956679615),
-                      (-0.26286555605956679615, -0.8090169943749474241, 1.11351636441160673519),
-                      (-0.26286555605956679615, 0.8090169943749474241, 1.11351636441160673519),
-                      (0.26286555605956679615, -0.8090169943749474241, -1.1135163644116066184),
-                      (0.26286555605956679615, 0.8090169943749474241, -1.1135163644116066184),
-                      (0.42532540417601996609, -1.3090169943749474241, 4.7169310137059937438),
-                      (0.42532540417601996609, -1.3090169943749474241, -0.26286555605956679615),
-                      (0.42532540417601996609, 1.3090169943749474241, 4.7169310137059937438),
-                      (0.42532540417601996609, 1.3090169943749474241, -0.26286555605956679615)],
-                      [9, 66, 47], [44, 62, 77], [20, 91, 49], [33, 47, 83],
-                      [3, 77, 84], [12, 49, 53], [36, 84, 66], [28, 53, 62],
-                      [73, 83, 91], [15, 84, 46], [25, 64, 43], [16, 58, 72],
-                      [26, 46, 51], [11, 43, 74], [4, 72, 91], [60, 74, 84],
-                      [35, 91, 64], [23, 51, 58], [19, 74, 77], [79, 83, 78],
-                      [6, 56, 40], [76, 77, 81], [21, 78, 75], [8, 40, 58],
-                      [31, 75, 74], [42, 58, 83], [41, 81, 56], [13, 75, 43],
-                      [27, 51, 47], [2, 89, 71], [24, 43, 62], [17, 47, 85],
-                      [14, 71, 56], [65, 85, 75], [22, 56, 51], [34, 62, 89],
-                      [5, 85, 78], [32, 81, 46], [10, 53, 48], [45, 78, 64],
-                      [7, 46, 66], [18, 48, 89], [37, 66, 85], [70, 89, 81],
-                      [29, 64, 53], [88, 74, 1], [38, 67, 48], [42, 83, 72],
-                      [57, 1, 85], [34, 48, 62], [59, 72, 87], [19, 62, 74],
-                      [63, 87, 67], [17, 85, 83], [52, 75, 1], [39, 87, 49],
-                      [22, 51, 40], [55, 1, 66], [29, 49, 64], [30, 40, 69],
-                      [13, 64, 75], [82, 69, 87], [7, 66, 51], [90, 85, 1],
-                      [59, 69, 72], [70, 81, 71], [88, 1, 84], [73, 72, 83],
-                      [54, 71, 68], [5, 83, 85], [50, 68, 69], [3, 84, 81],
-                      [57, 66, 1], [30, 68, 40], [28, 62, 48], [52, 1, 74],
-                      [23, 40, 51], [38, 48, 86], [9, 51, 66], [80, 86, 68],
-                      [11, 74, 62], [55, 84, 1], [54, 86, 71], [35, 64, 49],
-                      [90, 1, 75], [41, 71, 81], [39, 49, 67], [15, 81, 84],
-                      [61, 67, 86], [21, 75, 64], [24, 53, 43], [50, 69, 0],
-                      [37, 85, 47], [31, 43, 75], [61, 0, 67], [27, 47, 58],
-                      [10, 67, 53], [8, 58, 69], [90, 75, 85], [45, 91, 78],
-                      [80, 68, 0], [36, 66, 46], [65, 78, 85], [63, 0, 87],
-                      [32, 46, 56], [20, 87, 91], [14, 56, 68], [57, 85, 66],
-                      [33, 58, 47], [61, 86, 0], [60, 84, 77], [37, 47, 66],
-                      [82, 0, 69], [44, 77, 89], [16, 69, 58], [18, 89, 86],
-                      [55, 66, 84], [26, 56, 46], [63, 67, 0], [31, 74, 43],
-                      [36, 46, 84], [50, 0, 68], [25, 43, 53], [6, 68, 56],
-                      [12, 53, 67], [88, 84, 74], [76, 89, 77], [82, 87, 0],
-                      [65, 75, 78], [60, 77, 74], [80, 0, 86], [79, 78, 91],
-                      [2, 86, 89], [4, 91, 87], [52, 74, 75], [21, 64, 78],
-                      [18, 86, 48], [23, 58, 40], [5, 78, 83], [28, 48, 53],
-                      [6, 40, 68], [25, 53, 64], [54, 68, 86], [33, 83, 58],
-                      [17, 83, 47], [12, 67, 49], [41, 56, 71], [9, 47, 51],
-                      [35, 49, 91], [2, 71, 86], [79, 91, 83], [38, 86, 67],
-                      [26, 51, 56], [7, 51, 46], [4, 87, 72], [34, 89, 48],
-                      [15, 46, 81], [42, 72, 58], [10, 48, 67], [27, 58, 51],
-                      [39, 67, 87], [76, 81, 89], [3, 81, 77], [8, 69, 40],
-                      [29, 53, 49], [19, 77, 62], [22, 40, 56], [20, 49, 87],
-                      [32, 56, 81], [59, 87, 69], [24, 62, 53], [11, 62, 43],
-                      [14, 68, 71], [73, 91, 72], [13, 43, 64], [70, 71, 89],
-                      [16, 72, 69], [44, 89, 62], [30, 69, 68], [45, 64, 91]]
-    #  Actual volume is : 51.405764746872634
-    assert Abs(polytope_integrate(echidnahedron, 1) - 51.4057647468726) < 1e-12
-    assert Abs(polytope_integrate(echidnahedron, expr) - 253.569603474519) <\
-    1e-12
 
 @XFAIL
 def test_polytopes_intersecting_sides():
diff --git a/sympy/ntheory/tests/test_residue.py b/sympy/ntheory/tests/test_residue.py
index b0fa16972a..444469c4ca 100644
--- a/sympy/ntheory/tests/test_residue.py
+++ b/sympy/ntheory/tests/test_residue.py
@@ -1,5 +1,5 @@
 from collections import defaultdict
-from sympy import Symbol
+from sympy import S, Symbol, Tuple
 from sympy.core.compatibility import range
 
 from sympy.ntheory import n_order, is_primitive_root, is_quad_residue, \
@@ -65,6 +65,9 @@ def test_residue():
     raises(ValueError, lambda: is_quad_residue(2, 0))
 
 
+    assert quadratic_residues(S.One) == [0]
+    assert quadratic_residues(1) == [0]
+    assert quadratic_residues(12) == [0, 1, 4, 9]
     assert quadratic_residues(12) == [0, 1, 4, 9]
     assert quadratic_residues(13) == [0, 1, 3, 4, 9, 10, 12]
     assert [len(quadratic_residues(i)) for i in range(1, 20)] == \
@@ -161,6 +164,8 @@ def test_residue():
     assert is_nthpow_residue(31, 4, 41)
     assert not is_nthpow_residue(2, 2, 5)
     assert is_nthpow_residue(8547, 12, 10007)
+    assert nthroot_mod(29, 31, 74) == 31
+    assert nthroot_mod(*Tuple(29, 31, 74)) == 31
     assert nthroot_mod(1801, 11, 2663) == 44
     for a, q, p in [(51922, 2, 203017), (43, 3, 109), (1801, 11, 2663),
           (26118163, 1303, 33333347), (1499, 7, 2663), (595, 6, 2663),
@@ -236,3 +241,6 @@ def test_residue():
     assert discrete_log(2456747, 3**51, 3) == 51
     assert discrete_log(32942478, 11**127, 11) == 127
     assert discrete_log(432751500361, 7**324, 7) == 324
+    args = 5779, 3528, 6215
+    assert discrete_log(*args) == 687
+    assert discrete_log(*Tuple(*args)) == 687
diff --git a/sympy/utilities/tests/test_lambdify.py b/sympy/utilities/tests/test_lambdify.py
index 1d773f607e..2c5d5fee52 100644
--- a/sympy/utilities/tests/test_lambdify.py
+++ b/sympy/utilities/tests/test_lambdify.py
@@ -302,7 +302,7 @@ def test_math():
 
 def test_sin():
     f = lambdify(x, sin(x)**2)
-    assert isinstance(f(2), (float, mpmath.ctx_mp_python.mpf))
+    assert isinstance(f(2), float)
     f = lambdify(x, sin(x)**2, modules="math")
     assert isinstance(f(2), float)
 
diff --git a/sympy/vector/tests/test_coordsysrect.py b/sympy/vector/tests/test_coordsysrect.py
index 4e464051b9..43908b2635 100644
--- a/sympy/vector/tests/test_coordsysrect.py
+++ b/sympy/vector/tests/test_coordsysrect.py
@@ -249,7 +249,6 @@ def test_vector_with_orientation():
     assert C.j.cross(A.i) == (sin(q2))*A.j + (-cos(q2))*A.k
     assert express(C.k.cross(A.i), C).trigsimp() == cos(q3)*C.j
 
-
 def test_orient_new_methods():
     N = CoordSys3D('N')
     orienter1 = AxisOrienter(q4, N.j)
@@ -293,16 +292,6 @@ def test_locatenew_point():
     assert p2.express_coordinates(C) == (-2*a + 1, -2*b, -2*c)
 
 
-def test_create_new():
-    a = CoordSys3D('a')
-    c = a.create_new('c', transformation='spherical')
-    assert c._parent == a
-    assert c.transformation_to_parent() == \
-           (c.x*sin(c.y)*cos(c.z), c.x*sin(c.y)*sin(c.z), c.x*cos(c.y))
-    assert c.transformation_from_parent() == \
-           (sqrt(a.x**2 + a.y**2 + a.z**2), acos(a.z/sqrt(a.x**2 + a.y**2 + a.z**2)), atan2(a.y, a.x))
-
-
 def test_evalf():
     A = CoordSys3D('A')
     v = 3*A.i + 4*A.j + a*A.k