namespace HeuristicLab.Problems.DataAnalysis.Symbolic { public static class Algebraic { public static T Abs(this T a) where T : IAlgebraicType { a.AssignAbs(a.Clone()); return a; } public static T Neg(this T a) where T : IAlgebraicType { a.AssignNeg(a.Clone()); return a; } public static T Inv(this T a) where T : IAlgebraicType { a.AssignInv(a.Clone()); return a; } public static T Log(this T a) where T : IAlgebraicType { a.AssignLog(a.Clone()); return a; } public static T Exp(this T a) where T : IAlgebraicType { a.AssignExp(a.Clone()); return a; } public static T Sin(this T a) where T : IAlgebraicType { a.AssignSin(a.Clone()); return a; } public static T Cos(this T a) where T : IAlgebraicType { a.AssignCos(a.Clone()); return a; } public static T Sgn(this T a) where T : IAlgebraicType { a.AssignSgn(a.Clone()); return a; } public static T IntPower(this T a, int p) where T : IAlgebraicType { a.AssignIntPower(a.Clone(), p); return a; } public static T IntRoot(this T a, int r) where T : IAlgebraicType { a.AssignIntRoot(a.Clone(), r); return a; } // public static T Max(T a, T b) where T : IAlgebraicType { // // ((a + b) + abs(b - a)) / 2 // return a.Clone().Add(b).Add(b.Clone().Sub(a).Abs()).Scale(1.0 / 2.0); // } // public static T Min(T a, T b) where T : IAlgebraicType { // // ((a + b) - abs(a - b)) / 2 // return a.Clone().Add(b).Sub(a.Clone().Sub(b).Abs()).Scale(1.0 / 2.0); // } } }