public static ComplexD Sum(Func <int, ComplexD> series, int beginning, int end) { ComplexD sum = 0; for (int i = beginning; i <= end; i++) { sum += series(i); } return(sum); }
public static ComplexD Product(Func <int, ComplexD> series, int beginning, int end) { ComplexD product = 1; for (int i = beginning; i <= end; i++) { product *= series(i); } return(product); }
public static ComplexD Sqrt(ComplexD z) => Pow(z, 0.5);
public static ComplexD Sinh(ComplexD z) => (Exp(z) - Exp(-z)) / 2;
public static ComplexD Sin(ComplexD z) => (Exp(II * z) - Exp(-II * z)) / (2 * II);
public static ComplexD Sigm(ComplexD z) => 1 / (1 + Exp(-z));
public static ComplexD Acos(ComplexD z) => - II * Log(z + Sqrt(Pow(z, 2) - 1));
public static ComplexD Log(ComplexD z) => M.Log(z.Magnitude) + II * z.Phase;
public static ComplexD Log(ComplexD z, ComplexD b) => Log(z) / Log(b);
public static ComplexD Cosh(ComplexD z) => (Exp(z) + Exp(-z)) / 2;
public static ComplexD Exp(ComplexD z) => M.Exp(z.Re) * (M.Cos(z.Im) + II * M.Sin(z.Im));
public static ComplexD Cos(ComplexD z) => (Exp(II * z) + Exp(-II * z)) / 2;
public static ComplexD Atan(ComplexD z) => II / 2 * (Log(1 - II * z) - Log(1 + II * z));
public static ComplexD Asin(ComplexD z) => - II * Log(II * z + Sqrt(1 - Pow(z, 2)));
public static ComplexD Tan(ComplexD z) => Sin(z) / Cos(z);
public static ComplexD Pow(ComplexD z, ComplexD b) => Exp(Log(z) * b);
public static ComplexD Tanh(ComplexD z) => Sinh(z) / Cosh(z);
public static double Abs(ComplexD z) => z.Magnitude;