# Printing the power of vector/matrix elements using pow(x,a) | Linear Algebra using Python

Linear Algebra using Python | pow(x, a) Function: Here, we are going to learn how to print the power of vector/matrix elements using pow(x,a) in Python?
Submitted by Anuj Singh, on May 25, 2020

Prerequisite:

Numpy is the library of function that helps to construct or manipulate matrices and vectors. The function pow(x, a) is a function used for generating a matrix/vector/variable with the log value of b x (as xa). This is an element-wise operation where each element in pow(x, a) corresponds to the xa of that element in x.

Syntax:

```    power_matrix = pow(x,a)
```

Input parameter(s):

• x – could be a matrix or vector or a variable.

Return value:

A Matrix or vector or a variable of the same dimensions as input x with xa values at each entry.

Applications:

1. Machine Learning
2. Neural Network
3. General Mathematics

## Python code to print the power of vector/matrix elements

```# Linear Algebra Learning Sequence
# Element wise Power

import numpy as np

# Use of np.array() to define an Vector
V = np.array([3,6,8])
print("The Vector A : ",V)

# Using power function
print("\npow(A,3) : ", pow(V,3))
print("\npow(A,2) : ", pow(V,2))
```

Output:

```The Vector A :  [3 6 8]

pow(A,3) :  [ 27 216 512]

pow(A,2) :  [ 9 36 64]
```

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates