Trigonometric functions

xtensor provides the following trigonometric functions for xexpressions and scalars:

Defined in xtensor/xmath.hpp

template<class E>
inline auto xt::sin(E &&e) noexcept -> detail::xfunction_type_t<math::sin_fun, E>

Sine function.

Returns an xfunction for the element-wise sine of e (measured in radians).

Parameters

e – an xexpression

Returns

an xfunction

template<class E>
inline auto xt::cos(E &&e) noexcept -> detail::xfunction_type_t<math::cos_fun, E>

Cosine function.

Returns an xfunction for the element-wise cosine of e (measured in radians).

Parameters

e – an xexpression

Returns

an xfunction

template<class E>
inline auto xt::tan(E &&e) noexcept -> detail::xfunction_type_t<math::tan_fun, E>

Tangent function.

Returns an xfunction for the element-wise tangent of e (measured in radians).

Parameters

e – an xexpression

Returns

an xfunction

template<class E>
inline auto xt::asin(E &&e) noexcept -> detail::xfunction_type_t<math::asin_fun, E>

Arcsine function.

Returns an xfunction for the element-wise arcsine of e.

Parameters

e – an xexpression

Returns

an xfunction

template<class E>
inline auto xt::acos(E &&e) noexcept -> detail::xfunction_type_t<math::acos_fun, E>

Arccosine function.

Returns an xfunction for the element-wise arccosine of e.

Parameters

e – an xexpression

Returns

an xfunction

template<class E>
inline auto xt::atan(E &&e) noexcept -> detail::xfunction_type_t<math::atan_fun, E>

Arctangent function.

Returns an xfunction for the element-wise arctangent of e.

Parameters

e – an xexpression

Returns

an xfunction

template<class E1, class E2>
inline auto xt::atan2(E1 &&e1, E2 &&e2) noexcept -> detail::xfunction_type_t<math::atan2_fun, E1, E2>

Artangent function, using signs to determine quadrants.

Returns an xfunction for the element-wise arctangent of e1 / e2, using the signs of arguments to determine the correct quadrant.

Note

e1 and e2 can’t be both scalars.

Parameters
Returns

an xfunction