- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Compute the condition number of a matrix in linear algebra using Infinity norm in Python

To compute the condition number of a matrix in linear algebra, use the numpy.linalg.cond() method in Python. This method is capable of returning the condition number using one of seven different norms, depending on the value of p.

Returns the condition number of the matrix. May be infinite. The condition number of x is defined as the norm of x times the norm of the inverse of x; the norm can be the usual L2-norm or one of a number of other matrix norms. The 1st parameter is x, the matrix whose condition number is sought. The 2nd parameter is p, the Order of the norm used in the condition number computation. The "inf" set as a parameter is the positive infinity norm.

## Steps

At first, import the required libraries −

import numpy as np from numpy import linalg as LA

Create an array −

arr = np.array([[ 1, 1, 0], [1, 0, 1], [1, 0, 0]])

Display the array −

print("Our Array...

",arr)

Check the Dimensions −

print("

Dimensions of our Array...

",arr.ndim)

Get the Datatype −

print("

Datatype of our Array object...

",arr.dtype)

Get the Shape −

print("

Shape of our Array object...

",arr.shape)

To compute the condition number of a matrix in linear algebra, use the numpy.linalg.cond() method in Python. This method is capable of returning the condition number using one of seven different norms, depending on the value of p −

print("

Result...

",LA.cond(arr, np.inf))

## Example

import numpy as np from numpy import linalg as LA # Create an array arr = np.array([[ 1, 1, 0], [1, 0, 1], [1, 0, 0]]) # Display the array print("Our Array...

",arr) # Check the Dimensions print("

Dimensions of our Array...

",arr.ndim) # Get the Datatype print("

Datatype of our Array object...

",arr.dtype) # Get the Shape print("

Shape of our Array object...

",arr.shape) # To compute the condition number of a matrix in linear algebra, use the numpy.linalg.cond() method in Python print("

Result...

",LA.cond(arr, np.inf))

## Output

Our Array... [[1 1 0] [1 0 1] [1 0 0]] Dimensions of our Array... 2 Datatype of our Array object... int64 Shape of our Array object... (3, 3) Result... 4.0

- Related Articles
- Compute the condition number of a matrix in linear algebra using Negative Infinity norm in Python
- Compute the condition number of a matrix in linear algebra using Frobenius norm in Python
- Compute the condition number of a matrix in linear algebra using 2 norm in Python
- Compute the condition number of a matrix in linear algebra using negative 2 norm in Python
- Compute the condition number of a matrix in linear algebra in Python
- Return the infinity Norm of the matrix in Linear Algebra in Python
- Return the negative infinity Norm of the matrix in Linear Algebra in Python
- Return the Frobenius Norm of the matrix in Linear Algebra in Python
- Return the Nuclear Norm of the matrix in Linear Algebra in Python
- Return the Norm of the matrix or vector in Linear Algebra in Python
- Return the Norm of the matrix over axis in Linear Algebra in Python
- Return the Norm of the matrix or vector in Linear Algebra and also set the order in Python
- Return the Norm of the vector over given axis in Linear Algebra in Python
- Return the Norm of the vector over axis 1 in Linear Algebra in Python
- Return the Norm of the vector over axis 0 in Linear Algebra in Python