# Ruby program for r() method in Vector# Include matrix require"matrix"# Initialize the vector
vec1 =Vector[1,2,3]# Prints pythogras of the vector
puts vec1.r()
Ruby
输出:
3.7416573867739413
Ruby
例2 :
# Ruby program for r() method in Vector# Include matrix require"matrix"# Initialize the vector
vec1 =Vector[1,1,1]# Prints pythogras of the vector
puts vec1.r()