Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Log.java @ 4655:cd44d28d0fbc
Move the access to artifact data to the Access object
Use BedHeightAccess class to receive the data from the artifact. This abstracts
the data access from the actual artifact.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 11 Dec 2012 09:44:04 +0100 |
parents | 585c0b49e696 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.math.fitting; public class Log extends Function { public static final Derivative DERIVATIVE = new Derivative("W'(Q) = m/(Q+b)") { @Override public de.intevation.flys.artifacts.math.Function instantiate(double [] parameters) { final double m = parameters[0]; final double b = parameters[1]; return new de.intevation.flys.artifacts.math.Function() { @Override public double value(double Q) { return m/(Q+b); } }; } }; public static final Function INSTANCE = new Log(); public Log() { super("log", "W(Q) = m*ln(Q + b)", new String [] { "m", "b" }); } @Override public double value(double x, double [] parameters) { return parameters[0]*Math.log(x + parameters[1]); } @Override public double [] gradient(double x, double [] parameters) { double m = parameters[0]; double b = parameters[1]; double b_x = b + x; return new double [] { Math.log(b_x), m/b_x }; } @Override public Derivative getDerivative() { return DERIVATIVE; } @Override public Function getInverse() { return InvLog.INSTANCE; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :