示例#1
0
        public void DerivativeTest3()
        {
            // exp(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Exp(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) * exp(2 * x)", deriv.ToString());

            num.Value = 6;
            Assert.AreEqual("exp(6 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) * exp(2 * x)", deriv.ToString());
        }
示例#2
0
        public void ExpDerivativeTest3()
        {
            // exp(2x)
            var num = new Number(2);
            var x = new Variable("x");
            var mul = new Mul(num, x);

            var exp = new Exp(mul);
            var deriv = Differentiate(exp);

            Assert.Equal("2 * 1 * exp(2 * x)", deriv.ToString());

            num.Value = 6;
            Assert.Equal("exp(6 * x)", exp.ToString());
            Assert.Equal("2 * 1 * exp(2 * x)", deriv.ToString());
        }