Dear all,

I don't understand the usage of the new DerivativeStructure in version 3
of the commons math. 

In the old version I had the following function, which was then used in
the Newton solver:

public class MyFunction implements
         DifferentiableUnivariateRealFunction {


        public double value(double x) {
                // example value
                return x*x;
        }

        public UnivariateRealFunction derivative() {
                return new UnivariateRealFunction() {                   
                        public double value(double x) {
                                // example derivative   
                                return 2.*x;
                        }
                }
        }
}

To use the Newton Raphson solver in version 3, I have to implement the
new UnivariateDifferentiableFunction interface:

public class MyFunctionNew implements
         UnivariateDifferentiableFunction {

        public double value(double x) {
                // example value
                return x*x;
        }

        public DerivativeStructure value(DerivativeStructure t) {

                // What do I have to do here??
                // return what?
        }
}

I don't know how to use the DerivativeStructure. What do I have to do,
to get the same functionality like in the the previous function? How can
I define the derivative of my function? 
I tried to understand from the user guide, but it wasn't clear for me.

It would be great if someone could give me a hint or further explanation
on this.

Thank you very much in advance!

Best regards,
Franz


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to