示例#1
0
        public void DerivativeTest2()
        {
            IExpression exp = new Tan(new Mul(new Number(2), new Variable("x")));
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString());
        }
示例#2
0
        public void DerivativeTest1()
        {
            IExpression exp = new Tan(new Variable("x"));
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("1 / (cos(x) ^ 2)", deriv.ToString());
        }
示例#3
0
        public void DerivativeTest3()
        {
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

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

            Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString());

            num.Value = 5;
            Assert.AreEqual("tan(5 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString());
        }
示例#4
0
 public void PartialDerivativeTest3()
 {
     IExpression exp = new Tan(new Variable("x"));
     IExpression deriv = exp.Differentiate(new Variable("y"));
     Assert.AreEqual("0", deriv.ToString());
 }
示例#5
0
 public void PartialDerivativeTest2()
 {
     IExpression exp = new Tan(new Mul(new Variable("x"), new Variable("y")));
     IExpression deriv = exp.Differentiate(new Variable("y"));
     Assert.AreEqual("(x * 1) / (cos(x * y) ^ 2)", deriv.ToString());
 }