<commit_before>package etomica.util;

/**
 * Interface for the basic features of a function that maps a double onto
 * another double.
 */

public interface Function {

    public double f(double x);

    public double inverse(double f);

    public double dfdx(double x);

    /**
     * The function f(x) = constant
     */
    public static class Constant implements Function, java.io.Serializable {

        private double c;

        public Constant() {
            this(0.0);
        }

        public Constant(double c) {
            this.c = c;
        }

        public double f(double x) {
            return c;
        }

        public double inverse(double f) {
            throw new RuntimeException("function not invertible");
        }

        public double dfdx(double x) {
            return 0.0;
        }
    }

    /**
     * The function f(x) = x
     */
    public static class Identity implements Function, java.io.Serializable {

        public double f(double x) {
            return x;
        }

        public double inverse(double f) {
            return f;
        }

        public double dfdx(double x) {
            return 1.0;
        }

        public final static Identity INSTANCE = new Identity();
    }

    /**
     * The function f(x) = 1/x
     */
    public static class Reciprocal implements Function, java.io.Serializable {

        public double f(double x) {
            return 1.0 / x;
        }

        public double dfdx(double x) {
            return -1.0 / (x * x);
        }

        public double inverse(double x) {
            return 1.0 / x;
        }

        public final static Reciprocal INSTANCE = new Reciprocal();
    }

    /**
     * The function f(x) = ln(x)
     */
    public static class Log implements Function, java.io.Serializable {

        public double f(double x) {
            return Math.log(x);
        }

        public double dfdx(double x) {
            return 1.0 / x;
        }

        public double inverse(double x) {<commit_msg>Add exponential function<commit_after>package etomica.util;

/**
 * Interface for the basic features of a function that maps a double onto
 * another double.
 */

public interface Function {

    public double f(double x);

    public double inverse(double f);

    public double dfdx(double x);

    /**
     * The function f(x) = constant
     */
    public static class Constant implements Function, java.io.Serializable {

        private double c;

        public Constant() {
            this(0.0);
        }

        public Constant(double c) {
            this.c = c;
        }

        public double f(double x) {
            return c;
        }

        public double inverse(double f) {
            throw new RuntimeException("function not invertible");
        }

        public double dfdx(double x) {
            return 0.0;
        }
    }

    /**
     * The function f(x) = x
     */
    public static class Identity implements Function, java.io.Serializable {

        public double f(double x) {
            return x;
        }

        public double inverse(double f) {
            return f;
        }

        public double dfdx(double x) {
            return 1.0;
        }

        public final static Identity INSTANCE = new Identity();
    }

    /**
     * The function f(x) = 1/x
     */
    public static class Reciprocal implements Function, java.io.Serializable {

        public double f(double x) {
            return 1.0 / x;
        }

        public double dfdx(double x) {
            return -1.0 / (x * x);
        }

        public double inverse(double x) {
            return 1.0 / x;
        }

        public final static Reciprocal INSTANCE = new Reciprocal();
    }

    /**
     * The function f(x) = exp(x)
     */
    public static class Exp implements Function, java.io.Serializable {

        public double f(double x) {
            return Math.exp(x);
        }

        public double dfdx(double x) {
            return Math.exp(x);
        }

        public double inverse(double x) {
            return Math.log(x);
        }

        public final static Exp INSTANCE = new Exp();
    }

    /**
     * The function f(x) = ln(x)
     */
    public static class Log implements Function, java.io.Serializable {

        public double f(double x) {
            return Math.log(x);
        }

        public double dfdx(double x) {
            return 1.0 / x;
        }

        public double inverse(double x) {
{'fraction_non_alphanumeric': 0.09194376255300156, 'fraction_numerical': 0.006694934166480696, 'mean_word_length': 1.5293453724604966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4090418', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1214, 'n_words': 396}