Vous êtes un professionnel et vous avez besoin d'une formation ?
Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Module « scipy.special »
Signature de la fonction powm1
def powm1(*args, **kwargs)
Description
help(scipy.special.powm1)
powm1(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature])
powm1(x, y, out=None)
Computes ``x**y - 1``.
This function is useful when `y` is near 0, or when `x` is near 1.
The function is implemented for real types only (unlike ``numpy.power``,
which accepts complex inputs).
Parameters
----------
x : array_like
The base. Must be a real type (i.e. integer or float, not complex).
y : array_like
The exponent. Must be a real type (i.e. integer or float, not complex).
Returns
-------
array_like
Result of the calculation
Notes
-----
.. versionadded:: 1.10.0
The underlying code is implemented for single precision and double
precision floats only. Unlike `numpy.power`, integer inputs to
`powm1` are converted to floating point, and complex inputs are
not accepted.
Note the following edge cases:
* ``powm1(x, 0)`` returns 0 for any ``x``, including 0, ``inf``
and ``nan``.
* ``powm1(1, y)`` returns 0 for any ``y``, including ``nan``
and ``inf``.
This function wraps the ``powm1`` routine from the
Boost Math C++ library [1]_.
References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.
Examples
--------
>>> import numpy as np
>>> from scipy.special import powm1
>>> x = np.array([1.2, 10.0, 0.9999999975])
>>> y = np.array([1e-9, 1e-11, 0.1875])
>>> powm1(x, y)
array([ 1.82321557e-10, 2.30258509e-11, -4.68749998e-10])
It can be verified that the relative errors in those results
are less than 2.5e-16.
Compare that to the result of ``x**y - 1``, where the
relative errors are all larger than 8e-8:
>>> x**y - 1
array([ 1.82321491e-10, 2.30258035e-11, -4.68750039e-10])
Vous êtes un professionnel et vous avez besoin d'une formation ?
Programmation Python
Les fondamentaux
Voir le programme détaillé
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :