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