public void Comparer() { IndeterminateExpression a = 'a'; IndeterminateExpression b = 'b'; IndeterminateExpression sinA = IndeterminateExpression.Sin('a'); IndeterminateExpression sinB = IndeterminateExpression.Sin('b'); a.CompareTo(b).AssertIsEqualTo(-1); a.CompareTo(a).AssertIsEqualTo(0); b.CompareTo(a).AssertIsEqualTo(1); sinA.CompareTo(sinB).AssertIsEqualTo(-1); sinA.CompareTo(sinA).AssertIsEqualTo(0); sinB.CompareTo(sinA).AssertIsEqualTo(1); a.CompareTo(sinA).AssertIsEqualTo(-1); a.CompareTo(sinB).AssertIsEqualTo(-1); sinA.CompareTo(a).AssertIsEqualTo(1); sinB.CompareTo(a).AssertIsEqualTo(1); }
public void Constructor_Sin() { IndeterminateExpression v = IndeterminateExpression.Sin('v'); v.IsOne.AssertIsFalse(); v.HasUnaryModifier.AssertIsTrue(); Assert.Throws <InvalidOperationException>(() => { var _ = (char)v; }); v.ToString().AssertIsEqualTo("Sin(v)"); v.ToPower(2).ToString().AssertIsEqualTo("Sin²(v)"); v.GetOperation('v').Value(0).AssertIsEqualTo(0); v.GetOperation('v').Value(Math.PI / 2).AssertIsEqualTo(1); v.ToPower(2).DerivativeBy('v').AssertIsEqualTo(2 * Cos(Term.v) * Sin(Term.v)); v.SimplifyForConstant(0).AssertIsEqualTo(0); v.SimplifyForConstant(Math.PI / 2).AssertIsEqualTo(1); }
public void Sin_Variable() { PolynomialTerm.Sin(Term.a).AssertIsEqualTo(IndeterminateExpression.Sin('a')); }
public static PolynomialTerm Sin(PolynomialTerm term) => IndeterminateExpression.Sin((char)term);