README.markdown in polynomials-0.4.0 vs README.markdown in polynomials-0.4.1
- old
+ new
@@ -1,7 +1,9 @@
# Polynomials
+[![Build Status](http://travis-ci.org/mkorfmann/polynomials.png)](http://travis-ci.org/mkorfmann/polynomials)
+
## Usage
<pre><code>
require 'polynomials'
require 'gnuplot'
@@ -12,19 +14,21 @@
points = polynomial.roots | polynomial.local_extrema | polynomial.inflection_points
max_x = points.max_by(&:x).x
min_x = points.min_by(&:x).x
+max_x = max_x ? max_x.x : 1
+min_x = min_x ? min_x.x : -1
-start = (min_x - min_x.abs/2)
-stop = (max_x + max_x.abs/2)
+difference = (max_x-min_x).abs
-step = (max_x-min_x).abs/200
+start = min_x - difference/4.0
+stop = max_x + difference/4.0
+step = difference/200.0
-pointset = polynomials.pointset(start,stop,step)
-
-data_x = pointset.map(&:x)
-data_y = pointset.map(&:y)
+pointset = polynomial.pointset(start,stop,step)
+data_x = pointset.map(&:first)
+data_y = pointset.map(&:last)
Gnuplot.open do |gp|
Gnuplot::Plot.new(gp) do |plot|
plot.xrange "[#{start}:#{stop}]"
plot.title "Polynomial"