Hi Luc,
thank you for the explaination! The benchmark is a good idea. However, I
don't understand how I can give the derivation myself since version 3?
Cheers,
Franz
Am Donnerstag, den 23.05.2013, 20:44 +0200 schrieb Luc Maisonobe:
> Le 22/05/2013 15:24, Franz Simons a écrit :
> > Hi Thomas,
> >
> > great, it works that way! Thank you very much! It is nice that I don't
> > have to do the derivation myself anymore! Is there any perfomance
> > drawback if the derivation is done internally?
>
> Hi Franz,
>
> Yes, there are performance drawbacks as with a general framework, we
> cannot detect things like multiplications by 1 or additions of 0 and
> optimize these operations away. The performance drop highly depends on
> the function, so your mileage may vary. If you are concerned about that,
> I'll suggest you to do your own benchmarks. One very important feature
> is that with an automated framework, maintainance of the code is much
> easier when the complexity of the function increases.
>
> best regards,
> Luc
>
> >
> > Best regards,
> > Franz
> >
> >
> >
> > Am Mittwoch, den 22.05.2013, 14:51 +0200 schrieb Thomas Neidhart:
> >> Hi Franz,
> >>
> >> you can take a look at the following class which is used for the unit tests:
> >>
> >> public class QuinticFunction implements UnivariateDifferentiableFunction {
> >>
> >> /* Evaluate quintic.
> >> * @see org.apache.commons.math3.UnivariateFunction#value(double)
> >> */
> >> public double value(double x) {
> >> return (x1)*(x0.5)*x*(x+0.5)*(x+1);
> >> }
> >>
> >> public DerivativeStructure value(DerivativeStructure t) {
> >> return
> >> t.subtract(1).multiply(t.subtract(0.5)).multiply(t).multiply(t.add(0.5)).multiply(t.add(1));
> >> }
> >>
> >> }
> >>
> >> The DerivativeStructure provides the standard arithmetic operations which
> >> you can use.
> >> So in your case the value method would look like this imho:
> >>
> >> public DerivativeStructure value(DerivativeStructure t) {
> >> return t.multiply(t);
> >> }
> >>
> >> This just a quick help from myside, Luc (Maisonobe) will surely give you
> >> more infos on how to use the DerivativeStructure.
> >>
> >> Thomas
> >>
> >>
> >>
> >> On Tue, May 21, 2013 at 4:21 PM, Franz Simons <
> >> franz.simons@wahyd.tuberlin.de> wrote:
> >>
> >>> 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, email: userunsubscribe@commons.apache.org
> >>> For additional commands, email: userhelp@commons.apache.org
> >>>
> >>>
> >
>
>
> 
> To unsubscribe, email: userunsubscribe@commons.apache.org
> For additional commands, email: userhelp@commons.apache.org
>
>

Dipl.Ing. Franz Simons
Fachgebiet Wasserwirtschaft und Hydrosystemmodellierung
Chair of Water Resources Management and Modeling of Hydrosystems
Institut für Bauingenieurwesen
Technische Universität Berlin  Sekr. TIB 1B14
GustavMeyerAllee 25  13355 Berlin  Germany
Tel.: +49 30 31472429  Fax: +49 30 31472430
franz.simons@wahyd.tuberlin.de  www.wahyd.tuberlin.de

To unsubscribe, email: userunsubscribe@commons.apache.org
For additional commands, email: userhelp@commons.apache.org
