Example #1
0
        //COS
        public static double Cos(double x, int n = 0, double precision = 1e-5)
        {
            var t = Power(-1, n) * Power(x, 2 * n) / MathSyst.Fack((uint)(2 * n));

            if (MathSyst.Abs(t) < precision)
            {
                return(t);
            }
            return(t + Cos(x, n + 1, precision));
        }
Example #2
0
        //SIN
        public static double Sin(double x, int n = 1, double precision = 1e-5)
        {
            var t = MathSyst.Power(-1, n - 1) * MathSyst.Power(x, 2 * n - 1) / MathSyst.Fack((uint)(2 * n - 1));

            if (MathSyst.Abs(t) < precision)
            {
                return(t);
            }
            return(t + Sin(x, n + 1, precision));
        }
Example #3
0
        static public double Lognat(double x, int n = 1, double znat = 1e-5)
        {
            double t = MathSyst.Power(-1, n + 1) * MathSyst.Power(x - 1, n) / n;
            long   b = (long)t;

            if (MathSyst.Abs(t) < 1e-3)
            {
                return(t);
            }
            return(b + Lognat(x, n + 1, znat));
        }