Movatterモバイル変換


[0]ホーム

URL:


Skip to content

pow

pow(x1:array|int|float|complex,x2:array|int|float|complex,/)array

Calculates an implementation-dependent approximation of exponentiation by raising each elementx1_i (the base) of the input arrayx1 to the power ofx2_i (the exponent), wherex2_i is the corresponding element of the input arrayx2.

Parameters:
  • x1 (Union[array,int,float,complex]) – first input array whose elements correspond to the exponentiation base. Should have a numeric data type.

  • x2 (Union[array,int,float,complex]) – second input array whose elements correspond to the exponentiation exponent. Must be compatible withx1 (seeBroadcasting). Should have a numeric data type.

Returns:

out (array) – an array containing the element-wise results. The returned array must have a data type determined byType Promotion Rules.

Notes

  • At least one ofx1 orx2 must be an array.

  • If bothx1 andx2 have integer data types, the result ofpow whenx2_i is negative (i.e., less than zero) is unspecified and thus implementation-dependent.

  • Ifx1 has an integer data type andx2 has a floating-point data type, behavior is implementation-dependent (type promotion between data type “kinds” (integer versus floating-point) is unspecified).

  • By convention, the branch cut of the natural logarithm is the negative real axis\((-\infty, 0)\).

    The natural logarithm is a continuous function from above the branch cut, taking into account the sign of the imaginary component. As special cases involving complex floating-point operands should be handled according toexp(x2*log(x1)), exponentiation has the same branch cut forx1 as the natural logarithm (seelog()).

    Note: branch cuts follow C99 and have provisional status (seeBranch Cuts).

Special cases

For real-valued floating-point operands,

  • Ifx1_i is not equal to1 andx2_i isNaN, the result isNaN.

  • Ifx2_i is+0, the result is1, even ifx1_i isNaN.

  • Ifx2_i is-0, the result is1, even ifx1_i isNaN.

  • Ifx1_i isNaN andx2_i is not equal to0, the result isNaN.

  • Ifabs(x1_i) is greater than1 andx2_i is+infinity, the result is+infinity.

  • Ifabs(x1_i) is greater than1 andx2_i is-infinity, the result is+0.

  • Ifabs(x1_i) is1 andx2_i is+infinity, the result is1.

  • Ifabs(x1_i) is1 andx2_i is-infinity, the result is1.

  • Ifx1_i is1 andx2_i is notNaN, the result is1.

  • Ifabs(x1_i) is less than1 andx2_i is+infinity, the result is+0.

  • Ifabs(x1_i) is less than1 andx2_i is-infinity, the result is+infinity.

  • Ifx1_i is+infinity andx2_i is greater than0, the result is+infinity.

  • Ifx1_i is+infinity andx2_i is less than0, the result is+0.

  • Ifx1_i is-infinity,x2_i is greater than0, andx2_i is an odd integer value, the result is-infinity.

  • Ifx1_i is-infinity,x2_i is greater than0, andx2_i is not an odd integer value, the result is+infinity.

  • Ifx1_i is-infinity,x2_i is less than0, andx2_i is an odd integer value, the result is-0.

  • Ifx1_i is-infinity,x2_i is less than0, andx2_i is not an odd integer value, the result is+0.

  • Ifx1_i is+0 andx2_i is greater than0, the result is+0.

  • Ifx1_i is+0 andx2_i is less than0, the result is+infinity.

  • Ifx1_i is-0,x2_i is greater than0, andx2_i is an odd integer value, the result is-0.

  • Ifx1_i is-0,x2_i is greater than0, andx2_i is not an odd integer value, the result is+0.

  • Ifx1_i is-0,x2_i is less than0, andx2_i is an odd integer value, the result is-infinity.

  • Ifx1_i is-0,x2_i is less than0, andx2_i is not an odd integer value, the result is+infinity.

  • Ifx1_i is less than0,x1_i is a finite number,x2_i is a finite number, andx2_i is not an integer value, the result isNaN.

For complex floating-point operands, special cases should be handled as if the operation is implemented asexp(x2*log(x1)).

Note

Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.

Changed in version 2022.12:Added complex data type support.

Changed in version 2024.12:Added scalar argument support.


[8]ページ先頭

©2009-2025 Movatter.jp