Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.expm1

Contents

jax.numpy.expm1#

jax.numpy.expm1(x,/)[source]#

Calculateexp(x)-1 of each element of the input.

JAX implementation ofnumpy.expm1.

Parameters:

x (ArrayLike) – input array or scalar.

Returns:

An array containingexp(x)-1 of each element inx, promotes to inexactdtype.

Return type:

Array

Note

jnp.expm1 has much higher precision than the naive computation ofexp(x)-1 for small values ofx.

See also

Examples

>>>x=jnp.array([2,-4,3,-1])>>>withjnp.printoptions(precision=2,suppress=True):...print(jnp.expm1(x))[ 6.39 -0.98 19.09 -0.63]>>>withjnp.printoptions(precision=2,suppress=True):...print(jnp.exp(x)-1)[ 6.39 -0.98 19.09 -0.63]

For values very close to 0,jnp.expm1(x) is much more accurate thanjnp.exp(x)-1:

>>>x1=jnp.array([1e-4,1e-6,2e-10])>>>jnp.expm1(x1)Array([1.0000500e-04, 1.0000005e-06, 2.0000000e-10], dtype=float32)>>>jnp.exp(x1)-1Array([1.00016594e-04, 9.53674316e-07, 0.00000000e+00], dtype=float32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp