/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ /** * class for constructing * a function by scaling a given function f * g(x) = c * f(x)" */ //-------------------- public class ScaleFunction implements RealFunction { private double c; private RealFunction f; public ScaleFunction(double c, RealFunction f) { this.c = c; this.f = f; } public double at(double x) { return c * f.at(x); } public String toString() { return "" + c + "*" + f.toString(); } } //--------------------