def _mathstr(self, printer): if isinstance(self.set, AbstractSet): varstr = printer._print(self.function(*self.set.variables)) exprstr = printer._print(self.set.expr) return "{{{0} | {1}}}".format(varstr, exprstr) else: func = as_lambda(self.function) if len(func.variables) == 1: varstr = printer._print(func.variables[0]) else: varstr = printer._print(func.variables) elemstr = printer._print(func.expr) setstr = printer._print(self.set) return "{{{0} | {1} in {2}}}".format(elemstr, varstr, setstr)
def _image(self, func): if getattr(func, "is_invertible", False): inv_func = FunctionInverse(func, evaluate=True) if not isinstance(inv_func, FunctionInverse): inv_func = as_lambda(inv_func) return AbstractSet(inv_func.variables, zet.contains(inv_func.expr))