コード例 #1
0
        public void EvaluateTests(string expression, int expectedResult)
        {
            var subExpression = new SubExpression();

            int result = subExpression.Evaluate(expression);

            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #2
0
        public override object Evaluate()
        {
            object value = SubExpression.Evaluate();

            if (value is Complex)
            {
                return(Complex.Exp((Complex)value));
            }
            else if (value is CMatrix)
            {
                return(CMatrix.Exp((CMatrix)value));
            }

            throw ExceptionHelper.ThrowWrongArgumentType(value);
        }
コード例 #3
0
            public override object Evaluate()
            {
                object value = SubExpression.Evaluate();

                if (value is Complex)
                {
                    return(Complex.Negate((Complex)value));
                }
                else if (value is CMatrix)
                {
                    return(CMatrix.Negate((CMatrix)value));
                }
                else
                {
                    throw ThrowWrongArgumentType("-");
                }
            }
コード例 #4
0
        public void ErrorEvaluateTests(string expression)
        {
            var subExpression = new SubExpression();

            Assert.Throws(typeof(ArithmeticException), () => subExpression.Evaluate(expression));
        }
コード例 #5
0
 public override double Evaluate()
 {
     return(Math.Tanh(SubExpression.Evaluate()));
 }
コード例 #6
0
 public override double Evaluate()
 {
     return(-SubExpression.Evaluate());
 }