package com.srbenoit.math.solvers;

import com.srbenoit.log.LoggedObject;
import com.srbenoit.math.linear.TupleN;

/**
 * A base class for functions.
 */
public abstract class AbstractFunction extends LoggedObject {

    /**
     * Evaluate the function at a particular set of coordinates.
     *
     * @param   system       the system of functions to which the function belongs
     * @param   coordinates  the coordinates
     * @return  the value of the function at those coordinates
     */
    public abstract double evaluate(SystemOfFunctions system, TupleN coordinates);

    /**
     * Evaluate the partial derivative of the function with respect to a particular coordinate at a
     * particular set of coordinates.
     *
     * @param   system       the system of functions to which the function belongs
     * @param   coordinates  the coordinates
     * @param   index        the index of the coordinate that we want the derivative with respect to
     * @return  the value of the function at those coordinates
     */
    public abstract double derivative(SystemOfFunctions system, TupleN coordinates, int index);
}
