class_docstr: Represents integral of a scalar or vector field
  over a Parametric Region
  
  Examples
  ========
  
  >>> from sympy import cos, sin, pi
  >>> from sympy.vector import CoordSys3D, ParametricRegion, ParametricIntegral
  >>> from sympy.abc import r, t, theta, phi
  
  >>> C = CoordSys3D('C')
  >>> curve = ParametricRegion((3*t - 2, t + 1), (t, 1, 2))
  >>> ParametricIntegral(C.x, curve)
  5*sqrt(10)/2
  >>> length = ParametricIntegral(1, curve)
  >>> length
  sqrt(10)
  >>> semisphere = ParametricRegion((2*sin(phi)*cos(theta), 2*sin(phi)*sin(theta), 2*cos(phi)),                            (theta, 0, 2*pi), (phi, 0, pi/2))
  >>> ParametricIntegral(C.z, semisphere)
  8*pi
  
  >>> ParametricIntegral(C.j + C.k, ParametricRegion((r*cos(theta), r*sin(theta)), r, theta))
  0
class_docstr_tok: ["Represents","integral","of","a","scalar","or","vector","field","over","a","Parametric","Region","Examples","========",">",">",">","from","sympy","import","cos",",","sin",",","pi",">",">",">","from","sympy.vector","import","CoordSys3D",",","ParametricRegion",",","ParametricIntegral",">",">",">","from","sympy.abc","import","r",",","t",",","theta",",","phi",">",">",">","C","=","CoordSys3D","(","'","C","'",")",">",">",">","curve","=","ParametricRegion","(","(","3","*","t","-","2",",","t","+","1",")",",","(","t",",","1",",","2",")",")",">",">",">","ParametricIntegral","(","C.x",",","curve",")","5","*","sqrt","(","10",")","\/2",">",">",">","length","=","ParametricIntegral","(","1",",","curve",")",">",">",">","length","sqrt","(","10",")",">",">",">","semisphere","=","ParametricRegion","(","(","2","*","sin","(","phi",")","*","cos","(","theta",")",",","2","*","sin","(","phi",")","*","sin","(","theta",")",",","2","*","cos","(","phi",")",")",",","(","theta",",","0",",","2","*","pi",")",",","(","phi",",","0",",","pi\/2",")",")",">",">",">","ParametricIntegral","(","C.z",",","semisphere",")","8","*","pi",">",">",">","ParametricIntegral","(","C.j","+","C.k",",","ParametricRegion","(","(","r","*","cos","(","theta",")",",","r","*","sin","(","theta",")",")",",","r",",","theta",")",")","0"]
code: def __new__(cls, field, parametricregion):
      coord_set = _get_coord_systems(field)
  
      if len(coord_set) == 0:
          coord_sys = CoordSys3D("C")
      elif len(coord_set) > 1:
          raise ValueError
      else:
          coord_sys = next(iter(coord_set))
  
      if parametricregion.dimensions == 0:
          return S.Zero
  
      base_vectors = coord_sys.base_vectors()
      base_scalars = coord_sys.base_scalars()
  
      parametricfield = field
  
      r = Vector.zero
      for i in range(len(parametricregion.definition)):
          r += base_vectors[i] * parametricregion.definition[i]
  
      if len(coord_set) != 0:
          for i in range(len(parametricregion.definition)):
              parametricfield = parametricfield.subs(
                  base_scalars[i], parametricregion.definition[i]
              )
  
      if parametricregion.dimensions == 1:
          parameter = parametricregion.parameters[0]
  
          r_diff = diff(r, parameter)
          lower, upper = (
              parametricregion.limits[parameter][0],
              parametricregion.limits[parameter][1],
          )
  
          if isinstance(parametricfield, Vector):
              integrand = simplify(r_diff.dot(parametricfield))
          else:
              integrand = simplify(r_diff.magnitude() * parametricfield)
  
          result = integrate(integrand, (parameter, lower, upper))
  
      elif parametricregion.dimensions == 2:
          u, v = cls._bounds_case(
              parametricregion.parameters, parametricregion.limits
          )
  
          r_u = diff(r, u)
          r_v = diff(r, v)
          normal_vector = simplify(r_u.cross(r_v))
  
          if isinstance(parametricfield, Vector):
              integrand = parametricfield.dot(normal_vector)
          else:
              integrand = parametricfield * normal_vector.magnitude()
  
          integrand = simplify(integrand)
  
          lower_u, upper_u = (
              parametricregion.limits[u][0],
              parametricregion.limits[u][1],
          )
          lower_v, upper_v = (
              parametricregion.limits[v][0],
              parametricregion.limits[v][1],
          )
  
          result = integrate(
              integrand, (u, lower_u, upper_u), (v, lower_v, upper_v)
          )
  
      else:
          variables = cls._bounds_case(
              parametricregion.parameters, parametricregion.limits
          )
          coeff = (
              Matrix(parametricregion.definition)
              .jacobian(variables)
              .det()
          )
          integrand = simplify(parametricfield * coeff)
  
          l = [
              (
                  var,
                  parametricregion.limits[var][0],
                  parametricregion.limits[var][1],
              )
              for var in variables
          ]
          result = integrate(integrand, *l)
  
      if not isinstance(result, Integral):
          return result
      else:
          return super().__new__(cls, field, parametricregion)
  
file_path: sympy/sympy/vector/integrals.py
imports: from sympy.core import Basic, diff
  from sympy.core.singleton import S
  from sympy.core.sorting import default_sort_key
  from sympy.matrices import Matrix
  from sympy.integrals import Integral, integrate
  from sympy.geometry.entity import GeometryEntity
  from sympy.simplify.simplify import simplify
  from sympy.utilities.iterables import topological_sort
  from sympy.vector import CoordSys3D, Vector, ParametricRegion, parametric_region_list, ImplicitRegion
  from sympy.vector.operators import _get_coord_systems
label_desc: Use image node_id 1 for calling the ParametricIntegral obj's underlying member method code with example usage: obj.__new__(cls, field, parametricregion) and returns: S, result, super