diff --git a/src/unxt/_quantity/register_primitives.py b/src/unxt/_quantity/register_primitives.py index f662441..5e3b636 100644 --- a/src/unxt/_quantity/register_primitives.py +++ b/src/unxt/_quantity/register_primitives.py @@ -3308,6 +3308,33 @@ def _sort_p_one_operand( @register(lax.sqrt_p) def _sqrt_p(x: AbstractQuantity) -> AbstractQuantity: + """Square root of a quantity. + + Examples + -------- + >>> import quaxed.numpy as qnp + + >>> from unxt import UncheckedQuantity + >>> q = UncheckedQuantity(9, "m") + >>> qnp.sqrt(q) + UncheckedQuantity(Array(3, dtype=float32, ...), unit='m1/2') + + >>> from unxt import Quantity + >>> q = Quantity(9, "m") + >>> qnp.sqrt(q) + Quantity['length'](Array(3, dtype=float32, ...), unit='m1/2') + + >>> from unxt import Distance + >>> q = Distance(9, "m") + >>> qnp.sqrt(q) + Quantity['length'](Array(3, dtype=float32, ...), unit='m1/2') + + >>> from unxt import Parallax + >>> q = Parallax(9, "mas") + >>> qnp.sqrt(q) + Quantity['angle'](Array(3, dtype=float32, ...), unit='mas1/2') + + """ # Promote the Quantity to something that supports sqrt units. # E.g. Distance -> Quantity x = promote(x)[0]