From 569e3052f08a7fd803d80c12de70f1f02826cb7a Mon Sep 17 00:00:00 2001 From: Rakesh Kumar Shardiwal Date: Wed, 9 Jul 2014 15:46:46 +0530 Subject: [PATCH 1/6] Create .travis.yml Travis CI's build environment --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3edc366 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: perl +perl: + - "5.16" + - "5.14" + - "5.12" From a305a6fc0400e3acbcb97234ff50108927cbe9dd Mon Sep 17 00:00:00 2001 From: Rakesh Kumar Shardiwal Date: Wed, 9 Jul 2014 15:52:20 +0530 Subject: [PATCH 2/6] use travis status badges --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 3096d82..8668399 100644 --- a/README +++ b/README @@ -2,6 +2,8 @@ Math-Function-Interpolator Math::Function::Interpolator helps you to do the interpolation calculation with linear, quadratic and cubic methods. +[![Build Status](https://api.travis-ci.org/shardiwal/perl-Math-Function-Interpolator.png)](https://travis-ci.org/shardiwal/perl-Math-Function-Interpolator) + INSTALLATION To install this module, run the following commands: From 5661ab0ed80c8db0bf0e7a91956fa6f2306a7312 Mon Sep 17 00:00:00 2001 From: Rakesh Kumar Shardiwal Date: Wed, 9 Jul 2014 15:53:08 +0530 Subject: [PATCH 3/6] Rename README to README.md --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From e01a40c13256591d24d199a5e225898b34dc926a Mon Sep 17 00:00:00 2001 From: Rakesh Kumar Shardiwal Date: Wed, 9 Jul 2014 16:03:43 +0530 Subject: [PATCH 4/6] Create README --- README | 1 + 1 file changed, 1 insertion(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..897ce1b --- /dev/null +++ b/README @@ -0,0 +1 @@ +empty readme From cde63d190d7a1c221d874e1512c94480f63cf504 Mon Sep 17 00:00:00 2001 From: Rakesh Kumar Shardiwal Date: Wed, 9 Jul 2014 21:30:15 +0530 Subject: [PATCH 5/6] Update README --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 897ce1b..dd1e634 100644 --- a/README +++ b/README @@ -1 +1,3 @@ empty readme + +=for HTML From 3803b8247a61b5f0bdbc96416297f07a57d43bed Mon Sep 17 00:00:00 2001 From: Rakesh Kumar Shardiwal Date: Fri, 11 Jul 2014 11:36:17 +0530 Subject: [PATCH 6/6] More documentations --- README.md | 25 ++++++++++++++++++++- lib/Math/Function/Interpolator.pm | 11 +++++++-- lib/Math/Function/Interpolator/Cubic.pm | 2 +- lib/Math/Function/Interpolator/Linear.pm | 4 ++-- lib/Math/Function/Interpolator/Quadratic.pm | 4 ++-- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3cbd48a..576d190 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,32 @@ -Math-Function-Interpolator +**Math-Function-Interpolator** Math::Function::Interpolator helps you to do the interpolation calculation with linear, quadratic and cubic methods. +1. Linear method (needs more than 1 data point) +1. Quadratic method (needs more than 2 data points) +1. Cubic method, it's a Cubic Spline method (needs more than 4 data points) + + [![Build Status](https://travis-ci.org/binary-com/perl-Math-Function-Interpolator.svg?branch=master)](https://travis-ci.org/binary-com/perl-Math-Function-Interpolator) +SYNOPSIS + + use Math::Function::Interpolator; + + my $interpolator = Math::Function::Interpolator->new( + points => {1=>2,2=>3,3=>4,4=>5,5=>6,6=>7} + ); + + # Should have more than 1 data points + $interpolator->linear(2.5); + + # Should have more than 2 data points + $interpolator->quadratic(2.5); + + # Should have more than 4 data points + $interpolator->cubic(2.5); + + INSTALLATION To install this module, run the following commands: diff --git a/lib/Math/Function/Interpolator.pm b/lib/Math/Function/Interpolator.pm index a5d8064..da9526d 100644 --- a/lib/Math/Function/Interpolator.pm +++ b/lib/Math/Function/Interpolator.pm @@ -21,7 +21,7 @@ Math::Function::Interpolator - Interpolation made easy =head1 VERSION -Version 0.09 +Version 1.0 =head1 SYNOPSIS @@ -41,6 +41,10 @@ Version 0.09 Math::Function::Interpolator helps you to do the interpolation calculation with linear, quadratic and cubic methods. +1. Linear method (needs more than 1 data point) +1. Quadratic method (needs more than 2 data points) +1. Cubic method, it's a Cubic Spline method (needs more than 4 data points) + =head1 FIELDS =head2 points (REQUIRED) @@ -49,7 +53,7 @@ HashRef of points for interpolations =cut -our $VERSION = '0.09'; +our $VERSION = '1.0'; =head1 METHODS @@ -99,6 +103,7 @@ sub points { =head2 linear This method do the linear interpolation. It solves for point_y linearly given point_x and an array of points. +This method needs more than 1 data point. =cut @@ -117,6 +122,7 @@ sub linear { =head2 quadratic This method do the quadratic interpolation. It solves the interpolated_y value given point_x with 3 data points. +This method needs more than 2 data point. =cut @@ -135,6 +141,7 @@ sub quadratic { =head2 cubic This method do the cubic interpolation. It solves the interpolated_y given point_x and a minimum of 5 data points. +This method needs more than 4 data point. =cut diff --git a/lib/Math/Function/Interpolator/Cubic.pm b/lib/Math/Function/Interpolator/Cubic.pm index 5dd5610..4c6b8e2 100644 --- a/lib/Math/Function/Interpolator/Cubic.pm +++ b/lib/Math/Function/Interpolator/Cubic.pm @@ -22,7 +22,7 @@ Math::Function::Interpolator::Cubic use Math::Function::Interpolator::Cubic; my $interpolator = Math::Function::Interpolator::Cubic->new( - points => {1=>2,2=>3,3=>4} + points => {1=>2,2=>3,3=>4,4=>5,5=>6,6=>7} ); $interpolator->cubic(2.5); diff --git a/lib/Math/Function/Interpolator/Linear.pm b/lib/Math/Function/Interpolator/Linear.pm index eee61fb..89676f1 100644 --- a/lib/Math/Function/Interpolator/Linear.pm +++ b/lib/Math/Function/Interpolator/Linear.pm @@ -6,7 +6,7 @@ use warnings FATAL => 'all'; our @ISA = qw(Math::Function::Interpolator); -our $VERSION = '0.04'; +our $VERSION = '0.05'; use Carp qw(confess); use Number::Closest::XS qw(find_closest_numbers_around); @@ -29,7 +29,7 @@ Math::Function::Interpolator::Linear - Interpolation made easy =head1 DESCRIPTION Math::Function::Interpolator::Linear helps you to do the interpolation calculation with linear method. -It solves for point_y linearly given point_x and an array of points. +It solves for point_y linearly given point_x and an array of more than 2 data points. =head1 FIELDS diff --git a/lib/Math/Function/Interpolator/Quadratic.pm b/lib/Math/Function/Interpolator/Quadratic.pm index bdb12c5..51e3832 100644 --- a/lib/Math/Function/Interpolator/Quadratic.pm +++ b/lib/Math/Function/Interpolator/Quadratic.pm @@ -4,7 +4,7 @@ use 5.006; use strict; use warnings FATAL => 'all'; -our $VERSION = '0.05'; +our $VERSION = '0.06'; our @ISA = qw(Math::Function::Interpolator); @@ -29,7 +29,7 @@ Math::Function::Interpolator::Quadratic =head1 DESCRIPTION Math::Function::Interpolator::Quadratic helps you to do the interpolation calculation with quadratic method. -It solves the interpolated_y given point_x and a minimum of 5 data points. +It solves the interpolated_y given point_x and a minimum of 3 data points. =head1 FIELDS