Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Pow.java @ 3009:4dda67a893da
FixA: Added the derivatives of all fitting functions.
flys-artifacts/trunk@4565 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 31 May 2012 16:32:03 +0000 |
parents | 0dd58ab7e118 |
children | 585c0b49e696 |
comparison
equal
deleted
inserted
replaced
3008:9e0500d64524 | 3009:4dda67a893da |
---|---|
1 package de.intevation.flys.artifacts.math.fitting; | 1 package de.intevation.flys.artifacts.math.fitting; |
2 | 2 |
3 public class Pow | 3 public class Pow |
4 extends Function | 4 extends Function |
5 { | 5 { |
6 public static final Derivative DERIVATIVE = | |
7 new Derivative("W'(Q) = a*c*Q^(c-1)") { | |
8 | |
9 @Override | |
10 public de.intevation.flys.artifacts.math.Function | |
11 instantiate(double [] parameters) | |
12 { | |
13 final double a = parameters[0]; | |
14 final double c = parameters[1]; | |
15 | |
16 return new de.intevation.flys.artifacts.math.Function() { | |
17 @Override | |
18 public double value(double Q) { | |
19 return a*c*Math.pow(Q, c-1); | |
20 } | |
21 }; | |
22 } | |
23 }; | |
24 | |
6 public Pow() { | 25 public Pow() { |
7 super( | 26 super( |
8 "pow", | 27 "pow", |
9 "W(Q) = a*Q^c + d", | 28 "W(Q) = a*Q^c + d", |
10 new String [] { "a", "c", "d" }); | 29 new String [] { "a", "c", "d" }); |
24 x_c, | 43 x_c, |
25 a*x_c*Math.log(x), | 44 a*x_c*Math.log(x), |
26 1d | 45 1d |
27 }; | 46 }; |
28 } | 47 } |
48 | |
49 @Override | |
50 public Derivative getDerivative() { | |
51 return DERIVATIVE; | |
52 } | |
29 } | 53 } |
30 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 54 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |