GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 
  • Consortium for Python Data API Standards
  • API specification
  • Element-wise Functions
  • Purpose and scope
  • Terms and Definitions
  • Use cases
  • Assumptions
  • Design topics & constraints
  • Future API standard evolution
  • Array object
  • Broadcasting
  • Constants
  • Creation Functions

This view

  • Original page
  • New address

GeezerVison is showing data-apis.org — cos — Python array API standard DRAFT documentation

cos¶

cos(x: array, /) → array¶

Calculates an implementation-dependent approximation to the cosine for each element x_i of the input array x.

Each element x_i is assumed to be expressed in radians.

Note

The cosine is an entire function on the complex plane and has no branch cuts.

Note

For complex arguments, the mathematical definition of cosine is

\[\begin{split}\begin{align} \operatorname{cos}(x) &= \sum_{n=0}^\infty \frac{(-1)^n}{(2n)!} x^{2n} \\ &= \frac{e^{jx} + e^{-jx}}{2} \\ &= \operatorname{cosh}(jx) \end{align}\end{split}\]

where \(\operatorname{cosh}\) is the hyperbolic cosine.

Parameters:

x (array) – input array whose elements are each expressed in radians. Should have a floating-point data type.

Returns:

out (array) – an array containing the cosine of each element in x. The returned array must have a floating-point data type determined by Type Promotion Rules.

Notes

Special cases

For real-valued floating-point operands,

  • If x_i is NaN, the result is NaN.

  • If x_i is +0, the result is 1.

  • If x_i is -0, the result is 1.

  • If x_i is +infinity, the result is NaN.

  • If x_i is -infinity, the result is NaN.

For complex floating-point operands, special cases must be handled as if the operation is implemented as cosh(x*1j).

Changed in version 2022.12: Added complex data type support.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.