Ruby | Matrix find_element() function Last Updated : 14 Sep, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The find_index is an inbuilt method in Ruby returns the index position of the given number. If the element is present more than once, the first occurrence is returned. If the element is not present, then nil is returned. Syntax: mat1.find_index(element)Parameters: The function needs an element which is to be searched in matrix mat1.Return Value: It returns the row number and column number where the element is. Example 1: Ruby # Ruby program for find_index method in Matrix # Include matrix require "matrix" # Initializes the matrix mat1 = Matrix[[12, 21], [31, 12]] # Prints the index of 31 puts mat1.find_index(31) Output: 1 0 Example 2: Ruby # Ruby program for find_index method in Matrix # Include matrix require "matrix" # Initializes the matrix mat1 = Matrix[[6, 7], [9, 10], [12, 4]] # Prints the index of 12 puts mat1.find_index(12) Output: 2 0 Comment More infoAdvertise with us Next Article Ruby | Matrix column() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix element() function The element() is an inbuilt method in Ruby returns the element present at the intersection of i-th row and j-th column. Syntax: mat1.element(i, j) Parameters: The function accepts two parameters i and j which signifies the row_number and column_number. Return Value: It returns the element at mat[i][ 1 min read Ruby | Matrix eigen() function The eigen() is an inbuilt method in Ruby returns the Eigensystem of the matrix. Syntax: mat1.eigen() Parameters: The function does not accepts any parameter. Return Value: It returns the Eigensystem of the matrix. Example 1: Ruby # Ruby program for eigen() method in Matrix # Include matrix require 1 min read Ruby | Matrix eql? function The eql? is an inbuilt method in Ruby returns a boolean value. It returns true if both the matrix are equal or else it returns false.. Syntax: mat1.eql?(mat2)Parameters: The function need two matrix mat1 and mat2 which are to be compared.Return Value: It returns true if both the matrix are equal or 1 min read Ruby | Matrix det() function The det() is an inbuilt method in Ruby returns the determinant of the given matrix Syntax: mat1.det() Parameters: The function does not accepts any parameter. Return Value: It returns the determinant of the given matrix. Example 1: Ruby # Ruby program for det() method in Matrix # Include matrix requ 1 min read Ruby | Matrix column() function The column() is an inbuilt method in Ruby returns a vector that has all the elements in the column number col_num. Syntax: mat1.column(col_num) Parameters: The function accepts a parameter col_num which is the column number. Return Value: It returns a vector which has all the elements of column col_ 1 min read Ruby | Matrix determinant() function The determinant () is an inbuilt method in Ruby returns the determinant of the given matrix. Syntax: mat1.det() Parameters: The function does not accepts any parameter. Return Value: It returns the determinant of the given matrix. Example 1: Ruby # Ruby program for determinant() method in Matrix # I 1 min read Like