Found by the #302 adversarial review (2026-07-24), pre-existing (reproduced identically on unmodified development):
k = uw.expression(r'k', 1.0, 'constant')
sympy.Max(k, 0.5) # AttributeError: 'UWexpression' object has no attribute '_prec'
UWexpression reports is_comparable=True, so sympy's Max/Min attempts an immediate numeric comparison and reaches for the Float internals (_prec) that a Symbol subclass doesn't have. The failure is loud (not a silent-bake hazard), but it blocks the natural way of writing clamped/floored constants — users must route through uw.maths.smooth_max or wrap differently.
Likely fix: UWexpression should not advertise is_comparable (it is symbolic until packed), or MathematicalMixin should intercept Max/Min construction. See src/underworld3/utilities/mathematical_mixin.py.
Underworld development team with AI support from Claude Code
Found by the #302 adversarial review (2026-07-24), pre-existing (reproduced identically on unmodified development):
UWexpression reports
is_comparable=True, so sympy's Max/Min attempts an immediate numeric comparison and reaches for the Float internals (_prec) that a Symbol subclass doesn't have. The failure is loud (not a silent-bake hazard), but it blocks the natural way of writing clamped/floored constants — users must route through uw.maths.smooth_max or wrap differently.Likely fix: UWexpression should not advertise
is_comparable(it is symbolic until packed), or MathematicalMixin should intercept Max/Min construction. Seesrc/underworld3/utilities/mathematical_mixin.py.Underworld development team with AI support from Claude Code