Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Exp.java @ 3177:585c0b49e696
Added inverses of the fitting functions.
flys-artifacts/trunk@4792 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 26 Jun 2012 06:33:37 +0000 |
parents | 4dda67a893da |
children | 1c00ed73ccf4 |
comparison
equal
deleted
inserted
replaced
3176:cbaa49896eca | 3177:585c0b49e696 |
---|---|
8 | 8 |
9 @Override | 9 @Override |
10 public de.intevation.flys.artifacts.math.Function | 10 public de.intevation.flys.artifacts.math.Function |
11 instantiate(double [] parameters) | 11 instantiate(double [] parameters) |
12 { | 12 { |
13 final double m = parameters[0]; | 13 double m = parameters[0]; |
14 final double a = parameters[1]; | 14 final double a = parameters[1]; |
15 final double logam = Math.log(a)*m; | |
15 | 16 |
16 return new de.intevation.flys.artifacts.math.Function() { | 17 return new de.intevation.flys.artifacts.math.Function() { |
17 @Override | 18 @Override |
18 public double value(double Q) { | 19 public double value(double Q) { |
19 return Math.pow(a, Q)*Math.log(a)*m; | 20 return Math.pow(a, Q)*logam; |
20 } | 21 } |
21 }; | 22 }; |
22 } | 23 } |
23 }; | 24 }; |
25 | |
26 public static final Function INSTANCE = new Exp(); | |
24 | 27 |
25 public Exp() { | 28 public Exp() { |
26 super( | 29 super( |
27 "exp", | 30 "exp", |
28 "W(Q) = m * a^Q + b", | 31 "W(Q) = m * a^Q + b", |
45 | 48 |
46 @Override | 49 @Override |
47 public Derivative getDerivative() { | 50 public Derivative getDerivative() { |
48 return DERIVATIVE; | 51 return DERIVATIVE; |
49 } | 52 } |
53 | |
54 @Override | |
55 public Function getInverse() { | |
56 return InvExp.INSTANCE; | |
57 } | |
50 } | 58 } |
51 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 59 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |