Пример #1
0
        private static object Calculate(string expr)
        {
            var testCell = new MathCell(expr);

            testCell.EvaluateFormula();

            return(testCell.Value);
        }
Пример #2
0
 public void initialize(Range mathCellSizeRange, int testLength)
 {
     testConfig = new TestConfiguration(testLength);
     testConfig.initializePredictionPoints();
     dataFunction = RGen.gen.newRandMathCell(mathCellSizeRange, testConfig.argLength);
 }
Пример #3
0
        //todo: to get the best possible scaler, you must also consider the negative reflected
        //      line.  How can this be dealt with?
        public void scaleFromLastPredictions(double[] data)
        {
            int predictionOffset = data.Length - lastPredictions.Length;
            double avgDifference = 0;

            foreach (double p in lastPredictions)
            {
                avgDifference += data[predictionOffset] - p;
                predictionOffset++;
            }

            avgDifference /= lastPredictions.Length;

            DoubleCell scaler = new DoubleCell(avgDifference);
            ExpressionCell scaledFunction = new ExpressionCell(OpEnum.add,
                new MathCell[2] {scaler, dataFunction} );
            dataFunction = scaledFunction;
        }
Пример #4
0
 public ExpressionCell(OpEnum op, MathCell[] operationArgs)
 {
     this.op = op;
     this.operationArgs = operationArgs;
     checkOperationArgs();
 }
Пример #5
0
 public void replaceArg(int i, MathCell newCell)
 {
     if (i > operationArgs.Length)
     {
         throw new Exception("Invalid index " + i.ToString() +
             " in replacing an argument in the " + op.ToString() + " operation.");
     }
     if (newCell == null)
     {
         throw new Exception("Cannot have a null argument.");
     }
     operationArgs[i] = newCell;
 }