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

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

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

            num.Value = 3;
            Assert.AreEqual("cot(3 * x)", exp.ToString());
            Assert.AreEqual("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString());
        }
Beispiel #2
0
        public void CotDerivativeTest3()
        {
            // cot(2x)
            var num = new Number(2);
            var x = new Variable("x");
            var mul = new Mul(num, x);

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

            Assert.Equal("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString());

            num.Value = 3;
            Assert.Equal("cot(3 * x)", exp.ToString());
            Assert.Equal("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString());
        }