예제 #1
0
파일: plot.py 프로젝트: vperic/sympy
 def get_points(self):
     param = self.get_parameter_points()
     fx = vectorized_lambdify([self.var], self.expr_x)
     fy = vectorized_lambdify([self.var], self.expr_y)
     list_x = fx(param)
     list_y = fy(param)
     return (list_x, list_y)
예제 #2
0
파일: plot.py 프로젝트: sajithdilshan/sympy
 def get_points(self):
     param = self.get_parameter_points()
     fx = vectorized_lambdify([self.var], self.expr_x)
     fy = vectorized_lambdify([self.var], self.expr_y)
     list_x = fx(param)
     list_y = fy(param)
     return (list_x, list_y)
예제 #3
0
    def _get_meshes_grid(self):
        """Generates the mesh for generating a contour.

        In the case of equality, ``contour`` function of matplotlib can
        be used. In other cases, matplotlib's ``contourf`` is used.
        """
        equal = False
        if isinstance(self.expr, Equality):
            expr = self.expr.lhs - self.expr.rhs
            equal = True

        elif isinstance(self.expr, (GreaterThan, StrictGreaterThan)):
            expr = self.expr.lhs - self.expr.rhs

        elif isinstance(self.expr, (LessThan, StrictLessThan)):
            expr = self.expr.rhs - self.expr.lhs
        else:
            raise NotImplementedError("The expression is not supported for "
                                    "plotting in uniform meshed plot.")
        np = import_module('numpy')
        xarray = np.linspace(self.start_x, self.end_x, self.nb_of_points)
        yarray = np.linspace(self.start_y, self.end_y, self.nb_of_points)
        x_grid, y_grid = np.meshgrid(xarray, yarray)

        func = vectorized_lambdify((self.var_x, self.var_y), expr)
        z_grid = func(x_grid, y_grid)
        z_grid[np.ma.where(z_grid < 0)] = -1
        z_grid[np.ma.where(z_grid > 0)] = 1
        if equal:
            return xarray, yarray, z_grid, 'contour'
        else:
            return xarray, yarray, z_grid, 'contourf'
예제 #4
0
파일: plot.py 프로젝트: sajithdilshan/sympy
 def get_meshes(self):
     mesh_x, mesh_y = np.meshgrid(np.linspace(self.start_x, self.end_x,
                                              num=self.nb_of_points_x),
                                  np.linspace(self.start_y, self.end_y,
                                              num=self.nb_of_points_y))
     f = vectorized_lambdify((self.var_x, self.var_y), self.expr)
     return (mesh_x, mesh_y, f(mesh_x, mesh_y))
예제 #5
0
    def _get_meshes_grid(self):
        """Generates the mesh for generating a contour.

        In the case of equality, ``contour`` function of matplotlib can
        be used. In other cases, matplotlib's ``contourf`` is used.
        """
        equal = False
        if isinstance(self.expr, Equality):
            expr = self.expr.lhs - self.expr.rhs
            equal = True

        elif isinstance(self.expr, (GreaterThan, StrictGreaterThan)):
            expr = self.expr.lhs - self.expr.rhs

        elif isinstance(self.expr, (LessThan, StrictLessThan)):
            expr = self.expr.rhs - self.expr.lhs
        else:
            raise NotImplementedError("The expression is not supported for"
                                    "plotting in uniform meshed plot.")
        xarray = np.linspace(self.start_x, self.end_x, self.nb_of_points)
        yarray = np.linspace(self.start_y, self.end_y, self.nb_of_points)
        x_grid, y_grid = np.meshgrid(xarray, yarray)

        func = vectorized_lambdify((self.var_x, self.var_y), expr)
        z_grid = func(x_grid, y_grid)
        z_grid[np.ma.where(z_grid<0)] = -1
        z_grid[np.ma.where(z_grid>0)] = 1
        if equal:
            return xarray, yarray, z_grid, 'contour'
        else:
            return xarray, yarray, z_grid, 'contourf'
예제 #6
0
파일: plot.py 프로젝트: vperic/sympy
 def get_meshes(self):
     mesh_x, mesh_y = np.meshgrid(np.linspace(self.start_x, self.end_x,
                                              num=self.nb_of_points_x),
                                  np.linspace(self.start_y, self.end_y,
                                              num=self.nb_of_points_y))
     f = vectorized_lambdify((self.var_x, self.var_y), self.expr)
     return (mesh_x, mesh_y, f(mesh_x, mesh_y))
예제 #7
0
파일: plot.py 프로젝트: sajithdilshan/sympy
 def get_points(self):
     if self.only_integers == True:
         list_x = np.linspace(int(self.start), int(self.end),
                 num=int(self.end)-int(self.start)+1)
     else:
         list_x = np.linspace(self.start, self.end, num=self.nb_of_points)
     f = vectorized_lambdify([self.var], self.expr)
     list_y = f(list_x)
     return (list_x, list_y)
예제 #8
0
파일: plot.py 프로젝트: vperic/sympy
 def get_points(self):
     if self.only_integers == True:
         list_x = np.linspace(int(self.start), int(self.end),
                 num=int(self.end)-int(self.start)+1)
     else:
         list_x = np.linspace(self.start, self.end, num=self.nb_of_points)
     f = vectorized_lambdify([self.var], self.expr)
     list_y = f(list_x)
     return (list_x, list_y)
예제 #9
0
파일: plot.py 프로젝트: sajithdilshan/sympy
 def get_meshes(self):
     mesh_u, mesh_v = self.get_parameter_meshes()
     fx = vectorized_lambdify((self.var_u, self.var_v), self.expr_x)
     fy = vectorized_lambdify((self.var_u, self.var_v), self.expr_y)
     fz = vectorized_lambdify((self.var_u, self.var_v), self.expr_z)
     return (fx(mesh_u, mesh_v), fy(mesh_u, mesh_v), fz(mesh_u, mesh_v))
예제 #10
0
파일: plot.py 프로젝트: vperic/sympy
 def get_meshes(self):
     mesh_u, mesh_v = self.get_parameter_meshes()
     fx = vectorized_lambdify((self.var_u, self.var_v), self.expr_x)
     fy = vectorized_lambdify((self.var_u, self.var_v), self.expr_y)
     fz = vectorized_lambdify((self.var_u, self.var_v), self.expr_z)
     return (fx(mesh_u, mesh_v), fy(mesh_u, mesh_v), fz(mesh_u, mesh_v))