Exemplo n.º 1
0
        public void DerivativeTest2()
        {
            IExpression exp = new Exp(new Mul(new Number(2), new Variable("x")));
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) * exp(2 * x)", deriv.ToString());
        }
Exemplo n.º 2
0
        public void DerivativeTest1()
        {
            IExpression exp = new Exp(new Variable("x"));
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("1 * exp(x)", deriv.ToString());
        }
Exemplo n.º 3
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());
        }
Exemplo n.º 4
0
 public void PartialDerivativeTest3()
 {
     IExpression exp = new Exp(new Variable("x"));
     IExpression deriv = exp.Differentiate(new Variable("y"));
     Assert.AreEqual("0", deriv.ToString());
 }
Exemplo n.º 5
0
 public void PartialDerivativeTest1()
 {
     IExpression exp = new Exp(new Mul(new Variable("x"), new Variable("y")));
     IExpression deriv = exp.Differentiate();
     Assert.AreEqual("(1 * y) * exp(x * y)", deriv.ToString());
 }