Math::VarRate - deal with linear, variable rates of increase
Math::VarRate is a very, very poor man's calculus. A Math::VarRate object represents an accumulator that increases at a varying rate over time. The rate may change, it is always a linear, positive rate of change.
You can imagine the rate as representing "units gained per time." You can then interrogate the Math::VarRate object for the total units accumulated at any given offset in time, or for the time at which a given number of units will have first been accumulated.
my $varrate = Math::VarRate->new(\%arg);
Valid arguments to
rate_changes - a hashref in which keys are offsets and values are rates starting_value - the value at offset 0 (defaults to 0)
This method returns the value of the accumulator at offset 0.
my $offset = $varrate->offset_for($value);
This method returns the offset (positive, from 0) at which the given value is reached. If the given value will never be reached, undef will be returned.
my $value = $varrate->value_at($offset);
This returns the value in the accumulator at the given offset.
Ricardo SIGNES <firstname.lastname@example.org>
This software is copyright (c) 2009 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as perl itself.