log1p

Contents

log1p#

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

Natural logarithm of 1 + x, element-wise.

More accurate than log(1 + x) for small x.

Parameters:
  • x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Input array or Quantity.

  • unit_to_scale (saiunit.Unit | None) – Unit used to convert x to a dimensionless number first.

Returns:

out – Element-wise log(1 + x).

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.log1p(jnp.array([0.0, 1e-10]))
Array([0.e+00, 1.e-10], dtype=float32)