def __new__(cls, variables, expr): if not is_Tuple(variables) or len(variables) != 3: raise TypeError('variables is not a 3-Tuple: %s'%variables) if not is_Tuple(expr) or len(expr) != 3: raise TypeError('expr is not a 3-Tuple: %s'%expr) return Functor.__new__(cls, variables, expr)
def transform(self, st): """ >>> from sympy import * >>> from symplus.strplus import init_mprinting >>> init_mprinting() >>> m = translation([2,3,5]) >>> m.transform((1,2,3)) (3, 5, 8) >>> s = shearing(2*j,sqrt(3)*i) >>> m.transform(s) AffineTransformation([1 0 0; 2*sqrt(3) 1 0; 0 0 1], [0 -4*sqrt(3) 0]') >>> import symplus.setplus >>> x, y, z = symbols('x,y,z') >>> m.transform(AbstractSet((x,y,z), x**2+y**2+z**2<1)) {(x + 2, y + 3, z + 5) | x**2 + y**2 + z**2 < 1} """ if is_Tuple(st) and len(st) == 3: return self(*st) elif is_Function(st): return compose(self, st, inverse(self)) elif isinstance(st, Set): return Image(self, st) else: raise ValueError
def _contains(self, other): if not is_Tuple(other) or len(other) != 3: return false v = Mat(other) if self.closed: return dot(v, self.direction) >= self.offset else: return dot(v, self.direction) > self.offset
def _contains(self, other): if not is_Tuple(other) or len(other) != 3: return false v = Mat(other) p = v - self.center if self.closed: return norm(cross(p, self.direction)) <= self.slope*dot(p, self.direction) else: return norm(cross(p, self.direction)) < self.slope*dot(p, self.direction)
def _contains(self, other): if not is_Tuple(other) or len(other) != 3: return false v = Mat(other) p = v - self.center if self.closed: return norm(cross(p, self.direction))**2 <= self.radius**2 else: return norm(cross(p, self.direction))**2 < self.radius**2
def _contains(self, other): if not is_Tuple(other) or len(other) != 3: return false v = Mat(other) if self.closed: return norm(v-self.center)**2 <= self.radius**2 else: return norm(v-self.center)**2 < self.radius**2
def rename_variables_in(variables, varspace): if not is_Tuple(variables): return rename_variables_in((variables,), varspace)[0] names = [v.name for v in variables] namespace = {v.name for v in varspace} for i in range(len(names)): while names[i] in namespace: names[i] += '_' namespace.add(names[i]) return list(Symbol(n, **v.assumptions0) if isinstance(v, Symbol) else MatrixSymbol(n, v.rows, v.cols) for n, v in zip(names, variables))
def _contains(self, other): return is_Tuple(other) and len(other) == 3
def _contains(self, other): if not is_Tuple(other) or len(other) != 3: return false v = Mat(other) p = v - self.center return self.func(dot(p, self.direction), norm(cross(p, self.direction)))