Functions for secant, cosecant, and cotangent
![](https://secure.gravatar.com/avatar/ffdee4a05651aa04fcbed646d851d4cf.jpg?s=120&d=mm&r=g)
Hello, I noticed that current/past installations of Numpy do not have functions for secant, cosecant, and cotangent. Sometimes, there's a reason to use these over their less elegant forms of 1/cos, 1/sin, and 1/tan. Could this be something to be included in future installations of Numpy? I'd really appreciate it! Thank you, Jayanth kT
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
On Wed, Feb 12, 2025 at 5:12 PM Jayanth Tumuluri via NumPy-Discussion < numpy-discussion@python.org> wrote:
As for numpy itself, we've generally held the line for special/trig functions that we'll add those that are in the C99 standard, and leave the rest for scipy.special. These days, we defer to the Array API (if they add a new elementwise function, we're likely going to add it), but they have a roughly similar standard, though some functions that are really useful in neural networks have also made the leap. As for scipy.special, one of the considerations is if there are implementations of those functions that do anything other than just taking the reciprocal of the result of the main trig function. Taking a look at our special function libraries, that we might tap for this, I'm not seeing any that do implement these functions (the exception being the cotangent in degrees, which Cephes implements, and we already expose in scipy.special). -- Robert Kern
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
On Wed, Feb 12, 2025 at 5:12 PM Jayanth Tumuluri via NumPy-Discussion < numpy-discussion@python.org> wrote:
As for numpy itself, we've generally held the line for special/trig functions that we'll add those that are in the C99 standard, and leave the rest for scipy.special. These days, we defer to the Array API (if they add a new elementwise function, we're likely going to add it), but they have a roughly similar standard, though some functions that are really useful in neural networks have also made the leap. As for scipy.special, one of the considerations is if there are implementations of those functions that do anything other than just taking the reciprocal of the result of the main trig function. Taking a look at our special function libraries, that we might tap for this, I'm not seeing any that do implement these functions (the exception being the cotangent in degrees, which Cephes implements, and we already expose in scipy.special). -- Robert Kern
participants (2)
-
Jayanth Tumuluri
-
Robert Kern