jax.numpy.deg2rad#
- jax.numpy.deg2rad(x, /)[source]#
Convert angles from degrees to radians.
JAX implementation of
numpy.deg2rad
.The angle in degrees is converted to radians by:
\[deg2rad(x) = x * \frac{pi}{180}\]- Parameters:
x (ArrayLike) – scalar or array. Specifies the angle in degrees.
- Returns:
An array containing the angles in radians.
- Return type:
See also
jax.numpy.rad2deg()
andjax.numpy.degrees()
: Converts the angles from radians to degrees.jax.numpy.radians()
: Alias ofdeg2rad
.
Examples
>>> x = jnp.array([60, 90, 120, 180]) >>> jnp.deg2rad(x) Array([1.0471976, 1.5707964, 2.0943952, 3.1415927], dtype=float32) >>> x * jnp.pi / 180 Array([1.0471976, 1.5707964, 2.0943952, 3.1415927], dtype=float32, weak_type=True)