public string Equation()
    {
        string _operation = operations[(int)Random.Range(0,(operations.Count-1))] as string;
        int temp = (int)Random.Range(0,10);

        switch(_operation){
            case "+":
                EqFormat(temp,_operation);
                operation = EquationOperation.ADDITION;
                break;
            case "-":
                EqFormat(temp,_operation);
                operation = EquationOperation.SUBTRACTION;
                break;
            case "x":
                if(temp<1) temp = (int)Random.Range(1,9);
                EqFormat(temp,_operation);
                operation = EquationOperation.MULTIPLICATION;
                break;
            case "/":
                while(true){
                        if(!solution.Equals(0) && !temp.Equals(0)) break;
                        solution = (int)Random.Range(1,9);
                        temp = (int)Random.Range(1,9);
                }
                EqFormat(temp,_operation);
                operation = EquationOperation.DIVISION;
                break;
            default: //wtf
                break;
        }
        return equation;
    }
 public EquationViewModel()
 {
     Operation            = new EquationOperation();
     linearCommand        = new EquationCommand(Linear);
     powerFunctionCommand = new EquationCommand(PowerFunc);
     exponentialCommand   = new EquationCommand(Exponential);
 }
        /// <summary>
        /// Consists of a collection of expressions in brackets (if there are in the string) and a list of summands (contained between brackets, if any).
        /// If there are no brackets, then the monomial consists of one summand)
        /// </summary>
        /// <param name="monomialString"></param>
        /// <returns></returns>
        public static Monomial Parse(string monomialString)
        {
            if (monomialString == null)
            {
                throw new ArgumentNullException(nameof(monomialString));
            }
            if (monomialString.IsNullOrWhiteSpace())
            {
                throw new ArgumentException(nameof(monomialString));
            }

            var summandItems = ParseHelper.GetSummandsForMonomial(monomialString);

            //default value:
            //for brackets - 1 '(x-1) -> 1(x-1)'
            //otherwise - 0 'x^0 + a -> 1+a'
            var summand = summandItems.summandItems.Select(SummandParser.Parse).Multiply()
                          ?? new Summand(summandItems.bracketsParts.Count > 0 ? 1 : 0);


            IEnumerable <Summand> resultSummands = summand != null ? new [] { summand } : new Summand[] { };

            IEnumerable <Summand> result = resultSummands;

            foreach (var part in summandItems.bracketsParts)
            {
                var rightItems = PolynomialParser.Parse(part).Normalize().Summands.Sum();
                result = EquationOperation.Multiply(result, rightItems);
            }
            resultSummands = result.Sum();

            return(new Monomial(resultSummands ?? new Summand[] {}));
        }
        public void Test_PowerMethod()
        {
            EquationOperation Operation = new EquationOperation();
            bool cond = Operation.OperationFunction(Equation.PowerFunction, 1.0, 2.0);

            Assert.AreEqual(cond, true);
        }
        public void Test_ExponentialMethod()
        {
            EquationOperation Operation = new EquationOperation();
            bool cond = Operation.OperationFunction(Equation.Exponential, 1.0, 2.0);

            Assert.AreEqual(cond, true);
        }
        public void Test_ExponentialMethodData()
        {
            EquationOperation Operation = new EquationOperation();

            Operation.SetDefaultData();
            bool             cond = Operation.OperationFunction(Equation.Linear, 0, 0);
            List <DataPoint> data = Operation.GetPoints();

            Assert.AreEqual(data[0].X, 1);
            Assert.AreEqual(data[0].Y, 1);
            Assert.AreEqual(cond, true);
        }