I am having trouble using the UnivariateFunctionDifferentiator interface in java.
Quoted from the Commons Homepage:
"There are several ways a user can create an implementation of the UnivariateDifferentiableFunction interface. The first method is to simply write it directly using the appropriate methods from DerivativeStructure 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 and to pass it to an existing implementation of the UnivariateFunctionDifferentiator 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 API, or functions for which user does not have control to the full underlying code (for example functions that call external libraries)."
Now, my issue is simple. The first metod described above is very simple to implement yet not suitable for my situation. The reason is twofold. First, I have a very big function (about 40 elements) and, second, I already spend a couple of hours calculating the derivative. Hence, I am interested in using the UnivariateFunctionDifferentiator interface.
However, I can't come across any example or way to implement my univariate function f and its derivative using this UnivariateFunctionDifferentiator interface. It seems confusing to me exactly how to use this interface. My overall target is to use the newton-raphson method to solve f(x) = 0.
Does anyone have any experience in implenting this that could help me out? Thanks in advance for your help and please let me know if anything is not clarified enough!