# numpy.tril () in Python

|

numpy.tril (a, k = 0): returns a copy of the array with the bottom of the triangle relative to k
Parameters:

`  a:  input array  k:  [int, optional, 0 by default] Diagonal we require; k" 0 means diagonal above main diagonal or vice versa. `

Returns :

` Lower triangle of a, having same shape and data-type as a. `

 ` # Python Programming Illustrative ` ` # numpy.tril method `   ` import ` ` numpy as geek `   ` # input line ` ` a ` ` = ` ` geek.matrix ([[` ` 1 ` `, ` ` 21 ` `, ` ` 30 ` `], ` ` [` ` 63 ` `, ` ` 434 ` `, ` ` 3 ` `], ` ` [` ` 54 ` `, ` ` 54 ` `, ` ` 56 ` `]]) `   ` print ` ` (` ` "Main Diagonal elements:" ` `, geek.tril (a), ` ` "" ` `) `   ` print ` ` (` ` "Diagonal above main Diagonal elements:" ` `, geek.tril (a, ` ` 1 ` `), ` ` "" ` `) ` ` `  ` print ` ` (` `" Main Diagonal elements: "` `, geek.tril (a, ` ` - ` ` 1 ` `)) `

Output:

` Main Diagonal elements: [[1 0 0] [63 434 0] [54 54 56]] Diagonal above main Diagonal elements: [[1 21 0 ] [63 434 3] [54 54 56]] Main Diagonal elements: [[0 0 0] [63 0 0] [54 54 0]] `

https://docs.scipy.org/doc/numpy/reference /generated/numpy.tril.html#numpy.tril
Notes:
These NumPy-Python programs will not run by onlineID, so run them on your systems to study them

## Shop Learn programming in R: courses

\$ Best Python online courses for 2022

\$ Best laptop for Fortnite

\$ Best laptop for Excel

\$ Best laptop for Solidworks

\$ Best laptop for Roblox

\$ Best computer for crypto mining

\$ Best laptop for Sims 4

\$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method