Hello All, I ran into trouble while creating a Java program for the NewtonRaphsonSolver algorithm.
I made a post about this problem on Stack Overflow at http://stackoverflow.com/questions/32511458/java-derivativestructure-inside-the-apache-math-commons-library . At the bottom of the User Guide, the following information is posted There are several ways a user can create an implementation of the UnivariateDifferentiableFunction <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.html> interface. The first method is to simply write it directly using the appropriate methods from DerivativeStructure <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html> to compute addition, subtraction, sine, cosine... This is often quite straigthforward and there is no need to remember the rules for differentiation: the user code only represent the function itself, the differentials will be computed automatically under the hood. The second method is to write a classical UnivariateFunction <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html> and to pass it to an existing implementation of the UnivariateFunctionDifferentiator <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.html> interface to retrieve a differentiated version of the same function. The first method is more suited to small functions for which user already control all the underlying code. The second method is more suited to either large functions that would be cumbersome to write using the DerivativeStructure <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html> API, or functions for which user does not have control to the full underlying code (for example functions that call external libraries). The trouble occurs inside The second method is to write a classical UnivariateFunction <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html> and to pass it to an existing implementation of the UnivariateFunctionDifferentiator <http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.html> interface to retrieve a differentiated version of the same function. Would it be possible to create an example for the second method? This was rather confusing to a new user that has never implemented the Commons Math library. Please let me know if you would like any further information.
