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 LAB_3_CH
- {
- class Задание
- {
- static void Main(string[] args)
- {
- int n = 15;
- double a = 0.1, b = 1, k = 10;
- double periodx = ((b - a) / k);
- double e = 0.0001;
- double x = 0.1;
- Console.WriteLine("0,1 <= x <= 1 n = 15");
- Console.WriteLine(" ");
- while(x <= b)
- {
- double sn = (Math.Pow(-1, 1) * (Math.Pow((2 * x), 2))) / 2,
- res = 1,
- se = (Math.Pow(-1, 1) * (Math.Pow((2 * x), 2))) / 2;
- double y = 2 * (Math.Pow(Math.Cos(x), 2) - 1);
- for (int period1 = 1; period1 <= n; period1++)
- {
- int fact = 1;
- for (int i = 1; i <= period1; i++)
- {
- fact *= i;
- }
- res = (Math.Pow(-1, period1)*(Math.Pow((2 * x), (2 * period1)))) / (2 * fact);
- sn += res;
- }
- int period2 = 1;
- do
- {
- int fact = 1;
- for (int i = 1; i <= period2; i++)
- {
- fact *= i;
- }
- res = (Math.Pow(-1, period2) * (Math.Pow((2 * x), (2 * period2)))) / (2 * fact);
- se += res;
- period2++;
- }
- while (res >= e);
- Console.WriteLine("X={0:000000000000} SN={1:00000} SE={2:00000} Y={3:00000}", x, sn, se, y);
- x += periodx;
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement