Skip to content

Commit 2b7103e

Browse files
committed
Update docstring of acosh function to use math where applicable.
Also `arccosh` is now alias on `acosh` function.
1 parent 84af6d3 commit 2b7103e

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

dpnp/dpnp_iface_trigonometric.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ def _get_accumulation_res_dt(a, dtype):
155155
-----
156156
:obj:`dpnp.acos` is a multivalued function: for each `x` there are infinitely
157157
many numbers `z` such that :math:`cos(z) = x`. The convention is to return the
158-
angle `z` whose real part lies in :math:`[0, \pi]`.
158+
angle `z` whose the real part lies in the interval :math:`[0, \pi]`.
159159
160160
For real-valued floating-point input data types, :obj:`dpnp.acos` always
161161
returns real output. For each value that cannot be expressed as a real number
162162
or infinity, it yields ``NaN``.
163163
164164
For complex floating-point input data types, :obj:`dpnp.acos` is a complex
165165
analytic function that has, by convention, the branch cuts
166-
:math:`[-\infty, -1]` and :math:`[1, \infty]` and is continuous from above on
166+
:math:`(-\infty, -1]` and :math:`[1, \infty)` and is continuous from above on
167167
the former and from below on the latter.
168168
169169
The inverse cosine is also known as :math:`arccos` or :math:`cos^{-1}`.
@@ -190,17 +190,19 @@ def _get_accumulation_res_dt(a, dtype):
190190

191191

192192
_ACOSH_DOCSTRING = r"""
193-
Computes inverse hyperbolic cosine for each element `x_i` for input array `x`.
193+
Computes inverse hyperbolic cosine for each element :math:`x_i` for input array
194+
`x`.
194195
195-
The inverse of :obj:`dpnp.cosh` so that, if ``y = cosh(x)``, then ``x = arccosh(y)``.
196-
Note that :obj:`dpnp.acosh` is an alias of :obj:`dpnp.arccosh`.
196+
The inverse of :obj:`dpnp.cosh` so that, if :math:`y = cosh(x)`, then
197+
:math:`x = acosh(y)`. Note that :obj:`dpnp.arccosh` is an alias of
198+
:obj:`dpnp.acosh`.
197199
198-
For full documentation refer to :obj:`numpy.arccosh`.
200+
For full documentation refer to :obj:`numpy.acosh`.
199201
200202
Parameters
201203
----------
202204
x : {dpnp.ndarray, usm_ndarray}
203-
Input array, expected to have numeric data type.
205+
Input array, expected to have a floating-point data type.
204206
out : {None, dpnp.ndarray, usm_ndarray}, optional
205207
Output array to populate.
206208
Array must have the correct shape and the expected data type.
@@ -214,9 +216,9 @@ def _get_accumulation_res_dt(a, dtype):
214216
Returns
215217
-------
216218
out : dpnp.ndarray
217-
An array containing the element-wise inverse hyperbolic cosine, in
218-
radians and in the half-closed interval `[0, \infty)`. The data type
219-
of the returned array is determined by the Type Promotion Rules.
219+
An array containing the element-wise inverse hyperbolic cosine, in radians
220+
and in the half-closed interval :math:`[0, \infty)`. The data type of the
221+
returned array is determined by the Type Promotion Rules.
220222
221223
Limitations
222224
-----------
@@ -235,38 +237,41 @@ def _get_accumulation_res_dt(a, dtype):
235237
236238
Notes
237239
-----
238-
:obj:`dpnp.arccosh` is a multivalued function: for each `x` there are infinitely
239-
many numbers `z` such that ``cosh(z) = x``. The convention is to return the
240-
angle `z` whose real part lies in `[0, \infty]`.
240+
:obj:`dpnp.acosh` is a multivalued function: for each `x` there are infinitely
241+
many numbers `z` such that :math:`cosh(z) = x`. The convention is to return the
242+
angle `z` whose the real part lies in the interval :math:`[0, \infty)` and the
243+
imaginary part in the interval :math:`[-\pi, \pi]`.
241244
242-
For real-valued input data types, :obj:`dpnp.arccosh` always returns real output.
243-
For each value that cannot be expressed as a real number or infinity, it yields
244-
``NaN``.
245+
For real-valued floating-point input data types, :obj:`dpnp.acosh` always
246+
returns real output. For each value that cannot be expressed as a real number
247+
or infinity, it yields ``NaN``.
245248
246-
For complex-valued input, :obj:`dpnp.arccosh` is a complex analytic function that
247-
has, by convention, the branch cuts `[-\infty, 1]` and is continuous from above.
249+
For complex floating-point input data types, :obj:`dpnp.acosh` is a complex
250+
analytic function that has, by convention, the branch cuts :math:`(-\infty, 1]`
251+
and is continuous from above on it.
248252
249-
The inverse hyperbolic cos is also known as :math:`acosh` or :math:`cosh^{-1}`.
253+
The inverse hyperbolic cosine is also known as :math:`arccosh` or
254+
:math:`cosh^{-1}`.
250255
251256
Examples
252257
--------
253258
>>> import dpnp as np
254259
>>> x = np.array([1.0, np.e, 10.0])
255-
>>> np.arccosh(x)
260+
>>> np.acosh(x)
256261
array([0.0, 1.65745445, 2.99322285])
257262
258263
"""
259264

260-
arccosh = DPNPUnaryFunc(
261-
"arccosh",
265+
acosh = DPNPUnaryFunc(
266+
"acosh",
262267
ti._acosh_result_type,
263268
ti._acosh,
264269
_ACOSH_DOCSTRING,
265270
mkl_fn_to_call="_mkl_acosh_to_call",
266271
mkl_impl_fn="_acosh",
267272
)
268273

269-
acosh = arccosh # acosh is an alias for arccosh
274+
arccosh = acosh # arccosh is an alias for acosh
270275

271276

272277
_ASIN_DOCSTRING = r"""

0 commit comments

Comments
 (0)