public void DerivativeTest2() { IExpression exp = new Cot(new Mul(new Number(2), new Variable("x"))); IExpression deriv = exp.Differentiate(); Assert.AreEqual("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString()); }
public void DerivativeTest1() { IExpression exp = new Cot(new Variable("x")); IExpression deriv = exp.Differentiate(); Assert.AreEqual("-(1 / (sin(x) ^ 2))", deriv.ToString()); }
public void DerivativeTest3() { // cot(2x) Number num = new Number(2); Variable x = new Variable("x"); Mul mul = new Mul(num, x); IExpression exp = new Cot(mul); IExpression deriv = exp.Differentiate(); Assert.AreEqual("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString()); num.Value = 3; Assert.AreEqual("cot(3 * x)", exp.ToString()); Assert.AreEqual("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString()); }
public void PartialDerivativeTest3() { IExpression exp = new Cot(new Variable("x")); IExpression deriv = exp.Differentiate(new Variable("y")); Assert.AreEqual("0", deriv.ToString()); }
public void PartialDerivativeTest2() { IExpression exp = new Cot(new Mul(new Variable("x"), new Variable("y"))); IExpression deriv = exp.Differentiate(new Variable("y")); Assert.AreEqual("-((x * 1) / (sin(x * y) ^ 2))", deriv.ToString()); }