コード例 #1
0
ファイル: DifferentiatorTest.cs プロジェクト: sys27/xFunc
        public void SqrtDerivativeTest2()
        {
            var num = new Number(2);
            var x = new Variable("x");
            var mul = new Mul(num, x);

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

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

            num.Value = 3;
            Assert.Equal("sqrt(3 * x)", exp.ToString());
            Assert.Equal("(2 * 1) / (2 * sqrt(2 * x))", deriv.ToString());
        }
コード例 #2
0
        public void SqrtDerivativeTest2()
        {
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Sqrt(mul);
            IExpression deriv = Differentiate(exp);

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

            num.Value = 3;
            Assert.AreEqual("sqrt(3 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) / (2 * sqrt(2 * x))", deriv.ToString());
        }