Participer au site avec un Tip
Rechercher
 

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 :

Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Module « numpy.emath »

Fonction power - module numpy.emath

Signature de la fonction power

def power(x, p) 

Description

help(numpy.emath.power)

Return x to the power p, (x**p).

If `x` contains negative values, the output is converted to the
complex domain.

Parameters
----------
x : array_like
    The input value(s).
p : array_like of ints
    The power(s) to which `x` is raised. If `x` contains multiple values,
    `p` has to either be a scalar, or contain the same number of values
    as `x`. In the latter case, the result is
    ``x[0]**p[0], x[1]**p[1], ...``.

Returns
-------
out : ndarray or scalar
    The result of ``x**p``. If `x` and `p` are scalars, so is `out`,
    otherwise an array is returned.

See Also
--------
numpy.power

Examples
--------
>>> import numpy as np
>>> np.set_printoptions(precision=4)

>>> np.emath.power(2, 2)
4

>>> np.emath.power([2, 4], 2)
array([ 4, 16])

>>> np.emath.power([2, 4], -2)
array([0.25  ,  0.0625])

>>> np.emath.power([-2, 4], 2)
array([ 4.-0.j, 16.+0.j])

>>> np.emath.power([2, 4], [2, 4])
array([ 4, 256])



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé