examples/poly/demo.rb in gsl-1.15.3 vs examples/poly/demo.rb in gsl-1.16.0.6
- old
+ new
@@ -4,10 +4,10 @@
# Polynomial p(x) = 1.5-1.25x-3.75x^2+x^4
poly = Poly[1.5, -1.25, -3.75, 0, 1]
# Solve the equation p(x) == 0
root = poly.solve # Vector::Complex
-# Extract only the real parts
+# Extract only the real parts
# (imaginary parts are zero for this case)
re = root.real # Vector::View
puts("p(x) = 1.5-1.25x-3.75x^2+x^4 == 0")
puts("Roots are found at #{re[0]}, #{re[1]}, #{re[2]}, #{re[3]}")