O determinante() é um método embutido em Ruby que retorna o determinante da array fornecida.

Sintaxe : mat1.det()

Parâmetros : a função não aceita nenhum parâmetro.

Valor de retorno : retorna o determinante da array fornecida.

Exemplo 1 :

# Ruby program for determinant() method in Matrix
  
# Include matrix 
require "matrix"
  
# Initialize a matrix 
mat1 =  Matrix[[1, Complex(2, 1)], [Complex(8, -9), 18]]       
  
# prints the determinant 
puts  mat1.determinant()

Produto :

-7+10i

Exemplo 2 :

# Ruby program for determinant() method in Matrix
  
# Include matrix 
require "matrix"
  
# Initialize a matrix 
mat1 =  Matrix[[1, 1, 5], [4, 1, 5], [11, 2, 12]]       
  
# prints the determinant 
puts  mat1.determinant()

Produto :

-6