From: Nuggety Nanna Date: 2012-12-05T20:17:48+09:00 Subject: Re: Vectors & Surds in Ruby Jan E. wrote in post #1087901: > Unless there are other specifications that you didn't tell us, this is > nonsensical. Thanks for that, I wasn't aware that the "require matrix" was necessary. As for the surds, I am finding the square root of a set of values, and want the answer as an exact value, rather than a float. My code is below: begin puts "Do you want the length of Vector A or Vector B?" answer = gets.chomp.downcase end until answer == "a" || answer == "b" if answer == "a" len_vect_A = Math.sqrt(vect_Ax ** 2 + vect_Ay ** 2) puts "The length of vector A is #{len_vect_A.round(3)}" else len_vect_B = Math.sqrt(vect_Bx ** 2 + vect_By ** 2) puts "The length of vector B is #{len_vect_B.round(3)}" end -- Posted via http://www.ruby-forum.com/.