Exemple #1
0
        public void DerivativeTest2()
        {
            // sec(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

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

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

            num.Value = 4;
            Assert.AreEqual("sec(4 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) * (tan(2 * x) * sec(2 * x))", deriv.ToString());
        }
Exemple #2
0
        public void SecDerivativeTest2()
        {
            // sec(2x)
            var num = new Number(2);
            var x = new Variable("x");
            var mul = new Mul(num, x);

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

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

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