- 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
How to solve triangular matrix equations using Python SciPy?
The linear function named scipy.linalg.solveh_triangular is used to solve the banded matrix equation. In the below given example we will be solving the triangular system ax = b where −
$$\mathrm{a} = \begin{bmatrix} 3 & 0 & 0 & 0\ 2 & 1 & 0 & 0\ 1 &0 &1 &0 \ 1& 1& 1& 1 \end{bmatrix};\; \mathrm{b} =\begin{bmatrix} 1\ 2\ 1\ 2 \end{bmatrix}$$
Example
from scipy.linalg import solve_triangular import numpy as np a = np.array([[3, 0, 0, 0], [2, 1, 0, 0], [1, 0, 1, 0], [1, 1, 1, 1]]) b = np.array([1, 2, 1, 2]) x = solve_triangular(a, b, lower=True) print (x)
Output
array([ 0.33333333, 1.33333333, 0.66666667, -0.33333333])
- Related Articles
- Which linear function of SciPy is used to solve triangular matrix equations?
- How to solve a circulant matrix equation using Python SciPy?
- How to solve Hermitian positive-banded matrix equation using Python SciPy?
- Which linear function of SciPy is used to solve Toeplitz matrix using Levinson Recursion?
- Check if the matrix is lower triangular using Python
- Python Program to Display Upper Triangular Matrix
- Which linear function of SciPy is used to solve a banded matrix equation?
- Which linear function of SciPy is used to solve the circulant matrix equation?
- How to replace upper triangular matrix with lower triangular matrix and vice versa in R?
- How to find the Eigenvalues and Eigenvectors of a square matrix using SciPy?
- How to create an upper triangular matrix using vector elements in R?
- Which linear function of SciPy is used to solve Hermitian positive-definite banded matrix equation?
- Finding determinant of a square matrix using SciPy library
- Finding inverse of a square matrix using SciPy library
- How can SciPy be used to calculate the inverse of a matrix in Python?

Advertisements