hypot

Contents

hypot#

class saiunit.math.hypot(x, y, unit_to_scale=None, **kwargs)#

Given the legs of a right triangle, return its hypotenuse.

Computes sqrt(x**2 + y**2) element-wise.

Parameters:
  • x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – First leg.

  • y (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Second leg. Must be broadcastable with x.

  • unit_to_scale (saiunit.Unit | None) – Unit used to convert both inputs to dimensionless numbers.

Returns:

out – Hypotenuse values.

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.hypot(jnp.array([3.0]), jnp.array([4.0]))
Array([5.], dtype=float32)