Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Вычисление функции y=sinx");
- double x, y, sn, se;
- double step;
- int n = 10;
- step = (1.0 - 0.1) / 10;
- for (x = 0.1; x <= 1.0; x += step)
- {
- y = Math.Sin(x);
- double ae = x;
- double an = x;
- sn = an;
- se = ae;
- for (int i = 1; i <= n; i++)
- {
- an = an * (-x * x / (2 * i * (2 * i + 1)));
- Console.WriteLine(an);
- sn += an;
- }
- int j = 1;
- while (Math.Abs(y-ae) >= 0.0001)
- {
- ae = ae * (-x * x / (2 * j * (2 * j + 1)));
- se += ae;
- j++;
- }
- Console.WriteLine("X={0} SN={1} SE={2} Y={3}", x, sn, se, y);
- }
- Console.WriteLine("Нажмите любую клавишу...");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement