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()); }
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()); }