public void DerivativeTest2() { // lg(2x) Number num = new Number(2); Variable x = new Variable("x"); Mul mul = new Mul(num, x); IExpression exp = new Lg(mul); IExpression deriv = exp.Differentiate(); Assert.AreEqual("(2 * 1) / ((2 * x) * ln(10))", deriv.ToString()); num.Value = 3; Assert.AreEqual("lg(3 * x)", exp.ToString()); Assert.AreEqual("(2 * 1) / ((2 * x) * ln(10))", deriv.ToString()); }
public void LgDerivativeTest2() { // lg(2x) var num = new Number(2); var x = new Variable("x"); var mul = new Mul(num, x); var exp = new Lg(mul); var deriv = Differentiate(exp); Assert.Equal("(2 * 1) / (2 * x * ln(10))", deriv.ToString()); num.Value = 3; Assert.Equal("lg(3 * x)", exp.ToString()); Assert.Equal("(2 * 1) / (2 * x * ln(10))", deriv.ToString()); }