You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calculates an implementation-dependent approximation to the hyperbolic cosine, having domain ``[-infinity, +infinity]`` and codomain ``[-infinity, +infinity]``, for each element ``x_i`` in the input array ``x``.
430
+
r"""
431
+
Calculates an implementation-dependent approximation to the hyperbolic cosine for each element ``x_i`` in the input array ``x``.
432
+
433
+
The mathematical definition of the hyperbolic cosine is
434
+
435
+
.. math::
436
+
\operatorname{cosh}(x) = \frac{e^x + e^{-x}}{2}
432
437
433
438
**Special cases**
434
439
435
-
For floating-point operands,
440
+
.. note::
441
+
For all operands, ``cosh(x)`` must equal ``cosh(-x)``.
442
+
443
+
For real-valued floating-point operands,
436
444
437
445
- If ``x_i`` is ``NaN``, the result is ``NaN``.
438
446
- If ``x_i`` is ``+0``, the result is ``1``.
439
447
- If ``x_i`` is ``-0``, the result is ``1``.
440
448
- If ``x_i`` is ``+infinity``, the result is ``+infinity``.
441
449
- If ``x_i`` is ``-infinity``, the result is ``+infinity``.
442
450
451
+
For complex floating-point operands, let ``a = real(x_i)``, ``b = imag(x_i)``, and
452
+
453
+
.. note::
454
+
For complex floating-point operands, ``cosh(conj(x))`` must equal ``conj(cosh(x))``.
455
+
456
+
- If ``a`` is ``+0`` and ``b`` is ``+0``, the result is ``1 + 0j``.
457
+
- If ``a`` is ``+0`` and ``b`` is ``+infinity``, the result is ``NaN + 0j`` (sign of the imaginary component is unspecified).
458
+
- If ``a`` is ``+0`` and ``b`` is ``NaN``, the result is ``NaN + 0j`` (sign of the imaginary component is unspecified).
459
+
- If ``a`` is a nonzero finite number and ``b`` is ``+infinity``, the result is ``NaN + NaN j``.
460
+
- If ``a`` is a nonzero finite number and ``b`` is ``NaN``, the result is ``NaN + NaN j``.
461
+
- If ``a`` is ``+infinity`` and ``b`` is ``+0``, the result is ``+infinity + 0j``.
462
+
- If ``a`` is ``+infinity`` and ``b`` is a nonzero finite number, the result is ``+infinity * cis(b)``.
463
+
- If ``a`` is ``+infinity`` and ``b`` is ``+infinity``, the result is ``+infinity + NaN j`` (sign of the real component is unspecified).
464
+
- If ``a`` is ``+infinity`` and ``b`` is ``NaN``, the result is ``+infinity + NaN j``.
465
+
- If ``a`` is ``NaN`` and ``b`` is either ``+0`` or ``-0``, the result is ``NaN + 0j`` (sign of the imaginary component is unspecified).
466
+
- If ``a`` is ``NaN`` and ``b`` is a nonzero finite number, the result is ``NaN + NaN j``.
467
+
- If ``a`` is ``NaN`` and ``b`` is ``NaN``, the result is ``NaN + NaN j``.
468
+
469
+
where ``cis(v)`` is ``cos(v) + sin(v)*1j``.
470
+
471
+
.. note::
472
+
The hyperbolic cosine is an entire function in the complex plane and has no branch cuts. The function is periodic, with period :math:`2\pi j`, with respect to the imaginary component.
473
+
443
474
Parameters
444
475
----------
445
476
x: array
446
-
input array whose elements each represent a hyperbolic angle. Should have a real-valued floating-point data type.
477
+
input array whose elements each represent a hyperbolic angle. Should have a floating-point data type.
447
478
448
479
Returns
449
480
-------
450
481
out: array
451
-
an array containing the hyperbolic cosine of each element in ``x``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
482
+
an array containing the hyperbolic cosine of each element in ``x``. The returned array must have a floating-point data type determined by :ref:`type-promotion`.
0 commit comments