From ae9a6bad58019ef18657568e58f49459fbadc49c Mon Sep 17 00:00:00 2001 From: RncLsn Date: Fri, 14 Aug 2015 19:21:26 +0100 Subject: Incremental Skolemised store (not working). --- .../cs/pagoda/util/ExponentialInterpolation.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/uk/ac/ox/cs/pagoda/util/ExponentialInterpolation.java (limited to 'src/uk/ac/ox/cs/pagoda/util/ExponentialInterpolation.java') diff --git a/src/uk/ac/ox/cs/pagoda/util/ExponentialInterpolation.java b/src/uk/ac/ox/cs/pagoda/util/ExponentialInterpolation.java new file mode 100644 index 0000000..1d12169 --- /dev/null +++ b/src/uk/ac/ox/cs/pagoda/util/ExponentialInterpolation.java @@ -0,0 +1,33 @@ +package uk.ac.ox.cs.pagoda.util; + +/*** + * Get an exponential function given two points. + */ +public class ExponentialInterpolation { + + private final double base; + private final double multiplicativeFactor; + + /*** + * Compute the exponential function passing for the 2 given points. + * + * @param x1 + * @param y1 + * @param x2 + * @param y2 + */ + public ExponentialInterpolation(double x1, double y1, double x2, double y2) { + base = Math.pow(y2/y1, 1 / (x2 - x1)); + multiplicativeFactor = y1 / Math.pow(base, x1); + } + + /*** + * Compute value of the function in x. + * + * @param x + * @return + */ + public double computeValue(double x) { + return multiplicativeFactor * Math.pow(base, x); + } +} -- cgit v1.2.3