Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication6
- {
- class Program
- {
- static double SN (double x)
- {
- double s = 0, el = 1;
- for (int i = 1; i < 41; i++)
- {
- el *= -(x + 1) * (x + 1) / i;
- s += el;
- }
- return s;
- }
- static double SE (double x, double y, double eps)
- {
- double el = 1, s = 0;
- int i = 1;
- do
- {
- el *= (-(x + 1) * (x + 1)) / i;
- //el = Math.Pow(-1, i)*Math.Pow(x + 1, 2 * i) / i;
- i++;
- //Console.Write(s + " " + y);
- //Console.WriteLine();
- s += el;
- } while (Math.Abs(el) > eps);
- return s;
- }
- static void Main(string[] args)
- {
- double step = (-2 + 0.1) / 10;
- double x = -0.1;
- double y;
- double eps = 0.0001;
- for (int i = 1; i < 11; i++)
- {
- y = Math.Log(1 / (x * x + 2 * x + 2), Math.E);
- Console.WriteLine("SN = {0:0.000000000} SE = {1:0.000000000} x = {2:0.00}, y = {3:0.000000000}", SN(x), SE(x, y, eps), x, y);
- x += step;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement