public void DerivativeTest3() { Number num = new Number(2); Variable x = new Variable("x"); Mul mul = new Mul(num, x); IExpression exp = new Tan(mul); IExpression deriv = exp.Differentiate(); Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString()); num.Value = 5; Assert.AreEqual("tan(5 * x)", exp.ToString()); Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString()); }
public void TanDerivativeTest3() { var num = new Number(2); var x = new Variable("x"); var mul = new Mul(num, x); var exp = new Tan(mul); var deriv = Differentiate(exp); Assert.Equal("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString()); num.Value = 5; Assert.Equal("tan(5 * x)", exp.ToString()); Assert.Equal("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString()); }