Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
 public override RrFunction Inverse()
 {
     return(RrFunctions.Constant(1.0 / Value));
 }
Пример #5
0
 public static RrFunction Mult(ConstantRrFunction left, ConstantRrFunction right)
 {
     return(RrFunctions.Constant(left.Value * right.Value));
 }