001/* 002* ScalarFunctionND -- Defines an n-Dimensional sclar function y=fn(x[1..n]). 003* 004* Copyright (C) 2010-2025, by Joseph A. Huwaldt. All rights reserved. 005* 006* This library is free software; you can redistribute it and/or 007* modify it under the terms of the GNU Lesser General Public 008* License as published by the Free Software Foundation; either 009* version 2 of the License, or (at your option) any later version. 010* 011* This library is distributed in the hope that it will be useful, 012* but WITHOUT ANY WARRANTY; without even the implied warranty of 013* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014* Lesser General Public License for more details. 015* 016* You should have received a copy of the GNU Lesser General Public License 017* along with this program; if not, write to the Free Software 018* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 019* Or visit: http://www.gnu.org/licenses/lgpl.html 020*/ 021package jahuwaldt.tools.math; 022 023/** 024 * A class that defines an n-Dimensional scalar function y = fn(x[1..n]) (named 025 * "function") that can be called by math tools such as a function minimizer. Also defines 026 * the derivatives of the function in each dimension: (dy/dx)[1..n] = d fn(x[1..n])/dx 027 * (oddly enough, named "derivatives"). 028 * 029 * <p> Modified by: Joseph A. Huwaldt </p> 030 * 031 * @author Joseph A. Huwaldt Date: July 9, 2010 032 * @version February 23, 2025 033 */ 034public interface ScalarFunctionND { 035 036 /** 037 * User supplied method that calculates the function y = fn(x[1..n]). 038 * 039 * @param x Independent parameters to the function, passed in as input. 040 * @return The scalar function value for the provided list of inputs. 041 * @throws RootException if there is a problem computing the function. 042 */ 043 public double function(double x[]) throws RootException; 044 045 /** 046 * User supplied method that calculates the derivatives of the function: (dy/dx)[1..n] 047 * = d( fn(x[1..n]))/dx. 048 * 049 * @param x Independent parameters to the function, passed in as input. 050 * @param dydx Existing array that is filled in with the derivatives of the function 051 * with respect to each variable x[i]. 052 * @return <code>true</code> if the derivatives were computed by this method, 053 * <code>false</code> if they were not. 054 * @throws RootException if there is a problem computing the derivative. 055 */ 056 public boolean derivatives(double[] x, double[] dydx); 057 058}