1 Replies - 940 Views - Last Post: 31 March 2013 - 09:53 AM Rate Topic: -----

#1 jayy_two  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 28-October 12

determinant of 3x3 matrix in ruby

Posted 31 March 2013 - 09:47 AM

I'm very new to Ruby.
I have to calculate the determinant of a 3x3 matrix.
From what i've read this is all i could come up with


A = Matrix.build(3,3){rand}
A.determinant


but when I run it i get the error

prog.rb:1:in `<main>': uninitialized constant Matrix (NameError)

This post has been edited by xclite: 31 March 2013 - 09:55 AM
Reason for edit:: Don't remove the content of your posts - others might have similar questions.

Is This A Good Question/Topic? 0
  • +

Replies To: determinant of 3x3 matrix in ruby

#2 sepp2k  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2086
  • Posts: 3,173
  • Joined: 21-June 11

Re: determinant of 3x3 matrix in ruby

Posted 31 March 2013 - 09:53 AM

require 'matrix' at the beginning of your file.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1