Ruby | Matrix normal? function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The normal?() is an inbuilt method in Ruby returns a boolean value. It returns true if it is a normal matrix, else it returns false. It returns error if anything other than square matrix is used. Syntax: mat1.normal?() Parameters: The function needs the matrix to be checked for square or not. Return Value: It returns true if it is a square matrix, else it returns false. Example 1: CPP #Ruby program for normal ? () method in Matrix #Include matrix require "matrix" #Initialize a matrix mat1 = Matrix[[ 1, 21 ], [ 31, 18 ]] #Prints if normal ? or not puts mat1.normal ? () Output: false Example 2: CPP #Ruby program for normal ? () method in Matrix #Include matrix require "matrix" #Initialize a matrix mat1 = Matrix[[ 2, 1, 1 ], [ 1, 2, 1 ], [ 1, 1, 2 ]] #Prints if normal ? or not puts mat1.normal ? () Output: true Comment More infoAdvertise with us Next Article Ruby | Matrix real() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix real() function The real() is an inbuilt method in Ruby returns a matrix with only real part in it. The other index are assigned to zero. Syntax: mat1.real() Parameters: The function does not takes any parameter. Return Value: It returns a matrix with only real part. Example 1: CPP #Ruby program for real() method i 1 min read Ruby | Matrix real() function The real() is an inbuilt method in Ruby returns a matrix with only real part in it. The other index are assigned to zero. Syntax: mat1.real() Parameters: The function does not takes any parameter. Return Value: It returns a matrix with only real part. Example 1: CPP #Ruby program for real() method i 1 min read Ruby | Matrix real?() function The real?() is an inbuilt method in Ruby returns a boolean value. It returns true if all values in the matrix are real, else it returns false. Syntax: mat1.real?() Parameters: The function needs the matrix which is to be checked for real values Return Value: It returns true if it all values are real 1 min read Ruby | Matrix real?() function The real?() is an inbuilt method in Ruby returns a boolean value. It returns true if all values in the matrix are real, else it returns false. Syntax: mat1.real?() Parameters: The function needs the matrix which is to be checked for real values Return Value: It returns true if it all values are real 1 min read Ruby | Matrix minor() function The minor() is an inbuilt method in Ruby returns a section of the matrix. It either returns a matrix by taking the starting row, end row, start column, end column or by taking the range of rows and columns. Syntax: mat1.minor(start_row, end_row, start_col, end_col) or mat1.minor(row1..row2, col1..co 1 min read Ruby | Matrix minor() function The minor() is an inbuilt method in Ruby returns a section of the matrix. It either returns a matrix by taking the starting row, end row, start column, end column or by taking the range of rows and columns. Syntax: mat1.minor(start_row, end_row, start_col, end_col) or mat1.minor(row1..row2, col1..co 1 min read Like