public override RrFunction Add(RrFunction other) { var cst = other as ConstantRrFunction; if (cst != null) { return(RrFunctions.Constant(Value + cst.Value)); } var step = other as StepFunction; if (step != null) { return(StepFunction.Add(step, this)); } var spline = other as SplineInterpoler; if (spline != null) { return(SplineInterpoler.Add(spline, this)); } return(base.Add(other)); }
public override RrFunction Integral(double basePoint) { if (DoubleUtils.EqualZero(slope)) { return(RrFunctions.Constant(weight).Integral(basePoint)); } var zeroBaseIntegral = Create(weight / slope, slope); return(zeroBaseIntegral - zeroBaseIntegral.Eval(basePoint)); }
public static RrFunction Create(double weight, double slope) { if (DoubleUtils.EqualZero(weight)) { return(RrFunctions.Zero); } if (DoubleUtils.EqualZero(slope)) { return(RrFunctions.Constant(weight)); } return(new ExpRrFunction(weight, slope)); }
public override RrFunction Inverse() { return(RrFunctions.Constant(1.0 / Value)); }
public static RrFunction Mult(ConstantRrFunction left, ConstantRrFunction right) { return(RrFunctions.Constant(left.Value * right.Value)); }