# power

(^,.^) power operation

### Syntax

t = A ^ b t = A ** b t = A .^ b

### Arguments

- A, t
- a scalar, vector, or matrix of encoded integers, decimal or complex numbers, polynomials, or rationals.
- b
- a scalar, vector, or matrix of encoded integers, decimal or complex numbers.

If an operand are encoded integers, the other one can be only encoded integers or real numbers.

If `A`

are polynomials or rationals, `b`

can only be
a single decimal (positive or negative) integer.

### Description

##### .^ by-element power

If `A`

or `b`

is scalar, it is first
replicated to the size of the other, with A*ones(b) or b*ones(A).
Otherwise, `A`

and `b`

must have the same size.

Then, for each element of index i, `t(i) = A(i)^b(i)`

is computed.

##### ^ matricial power

The ^ operator is equivalent to the .^ by-element power in the following cases:

`A`

is scalar and`b`

is a vector.`A`

is a vector and`b`

is scalar.

`A`

or `b`

must be a scalar,
and the other one must be a square matrix:
If

`A`

is scalar and`b`

is a square matrix, then`A^b`

is the matrix`expm(log(A) * b)`

If

`A`

is a square matrix and`b`

is scalar, then`A^b`

is the matrix`A`

to the power`b`

.

##### Remarks

For square matrices

`A^p`

is computed through successive matrices multiplications if`p`

is a positive integer, and by*diagonalization*if not (see "note 2 and 3" below for details).If

`A`

is a square and Hermitian matrix and`p`

is a non-integer scalar,`A^p`

is computed as:`A^p = u*diag(diag(s).^p)*u'`

(For real matrix`A`

, only the real part of the answer is taken into account).`u`

and`s`

are determined by`[u,s] = schur(A)`

.If

`A`

is not a Hermitian matrix and`p`

is a non-integer scalar,`A^p`

is computed as:`A^p = v*diag(diag(d).^p)*inv(v)`

(For real matrix`A`

, only the real part of the answer is taken into account).`d`

and`v`

are determined by`[d,v] = bdiag(A+0*%i)`

.If

`A`

and`p`

are real or complex numbers,`A^p`

is the*principal value*determined byIf

`A`

is a square matrix and`p`

is a real or complex number,`A.^p`

is the*principal value*computed as:`**`

and`^`

operators are synonyms.

Exponentiation is right-associative in Scilab, contrarily to Matlab® and Octave.
For example 2^3^4 is equal to 2^(3^4) in Scilab, but to (2^3)^4 in Matlab® and Octave. |

### Examples

### See also

### History

Versão | Descrição |

6.0.0 | With decimal or complex numbers, `scalar ^ squareMat` now
yields `expm(log(scalar)*squareMat)` instead of
`scalar .^ squareMat` |

Report an issue | ||

<< polar | Exponential | sqrt >> |