Ruby | Matrix lower_triangular? function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The lower_triangular?() is an inbuilt method in Ruby returns a boolean value. It returns true if it is a lower-triangular matrix, else it returns false. Syntax: mat1.lower_triangular?() Parameters: The function needs the matrix to be checked for lower-triangular. Return Value: It returns true if it is a lower-triangular matrix, else it returns false. Example 1: CPP #Ruby program for lower_triangular ? () method in Matrix #Include matrix require "matrix" #Initialize a matrix mat1 = Matrix[[ 1, 21 ], [ 31, 18 ]] #Prints if lower_triangular or not puts mat1.lower_triangular ? () Output: false Example 2: CPP #Ruby program for lower_triangular ? () method in Matrix #Include matrix require "matrix" #Initialize a matrix mat1 = Matrix[[ 1, 0, 0 ], [ 2, 3, 0 ], [ 31, 18, 19 ]] #Prints if lower_triangular or not puts mat1.lower_triangular ? () Output: true Comment More infoAdvertise with us Next Article Ruby | Matrix lower_triangular? function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix singular?() function The singular?() is an inbuilt method in Ruby returns a boolean value. It returns true if it is a singular matrix, else it returns false. It returns error if anything other than square matrix is used. Syntax: mat1.singular?() Parameters: The function needs the matrix to be checked for singular matrix 1 min read Ruby | Matrix upper_triangular?() function The upper_triangular?() is an inbuilt method in Ruby returns a boolean value. It returns true if it is a lower-triangular matrix, else it returns false. Syntax: mat1.upper_triangular?() Parameters: The function needs the matrix to be checked for lower-triangular. Return Value: It returns true if it 1 min read Ruby | Matrix scalar() function The scalar() is an inbuilt method in Ruby returns an N x N diagonal matrix where each diagonal element is value. Syntax: mat1.scalar(N, value) Parameters: The function accepts twos mandatory parameters N and value where N is the size of the Identity matrix and value is the value to be assigned to th 1 min read Ruby | Matrix tr() function The tr() is an inbuilt method in Ruby returns the trace i.e., sum of diagonal elements of the matrix. Syntax: mat1.tr() Parameters: The function needs the matrix whose trace is to be returned. Return Value: It returns the trace. Example 1: Ruby # Ruby program for tr() method in Matrix # Include matr 1 min read Ruby | Matrix trace() function The trace() is an inbuilt method in Ruby returns the trace i.e., sum of diagonal elements of the matrix. Syntax: mat1.trace() Parameters: The function needs the matrix whose trace is to be returned. Return Value: It returns the trace. Example 1: Ruby # Ruby program for trace() method in Matrix # Inc 1 min read Like