def apply_makeboxes(self, expr, n, f, evaluation): '''MakeBoxes[BaseForm[expr_, n_], f:StandardForm|TraditionalForm|OutputForm]''' base = n.get_int_value() if base <= 0: evaluation.message('BaseForm', 'intpm', expr, n) return if not (isinstance(expr, Integer) or isinstance(expr, Real)): return Expression("MakeBoxes", expr, f) p = dps(expr.get_precision()) if isinstance(expr, Real) else 0 try: val = convert_base(expr.get_real_value(), base, p) except ValueError: return evaluation.message('BaseForm', 'basf', n) if f.get_name() == 'System`OutputForm': return from_python("%s_%d" % (val, base)) else: return Expression('SubscriptBox', from_python(val), from_python(base))
def apply_makeboxes(self, expr, n, f, evaluation): '''MakeBoxes[BaseForm[expr_, n_], f:StandardForm|TraditionalForm|OutputForm]''' base = n.get_int_value() if base <= 0: evaluation.message('BaseForm', 'intpm', expr, n) return if not (isinstance(expr, Integer) or isinstance(expr, Real)): return Expression("MakeBoxes", expr, f) p = dps(expr.get_precision()) if isinstance(expr, Real) else 0 try: val = convert_base(expr.get_real_value(), base, p) except ValueError: return evaluation.message('BaseForm', 'basf', n) if f.get_name() == 'System`OutputForm': return from_python("%s_%d" % (val, base)) else: return Expression( 'SubscriptBox', from_python(val), from_python(base))
def apply_makeboxes(self, expr, n, f, evaluation): """MakeBoxes[BaseForm[expr_, n_], f:StandardForm|TraditionalForm|OutputForm]""" base = n.get_int_value() if base <= 0: evaluation.message("BaseForm", "intpm", expr, n) return if not (isinstance(expr, Integer) or isinstance(expr, Real)): return Expression("MakeBoxes", expr, f) p = dps(expr.get_precision()) if isinstance(expr, Real) else 0 val = convert_base(expr.get_real_value(), base, p) if f.get_name() == "OutputForm": return from_python("%s_%d" % (val, base)) else: return Expression("SubscriptBox", from_python(val), from_python(base))