Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double x1 = 0.1, x2 = 0.8, e = 0.0001;
  10. int n = 50, k = 10;
  11. double x, y, SN, SE;
  12. x = x1;
  13. for (int i = 1; i <= k; i++)
  14. {
  15. y = 0.5 - (Math.PI / 4 * Math.Abs(Math.Sin(x)));
  16. SN = 0;
  17. SE = 0;
  18. for (int j=1; j <= n; j++)
  19. {
  20. SN = SN + (Math.Cos(2 * j * x)) / (Math.Pow(j, 2) * 4 - 1);
  21. }
  22. n = 0;
  23. do
  24. {
  25. n++;
  26. SE = SE + (Math.Cos(2 * n * x)) / (Math.Pow(n, 2) * 4 - 1);
  27. } while (Math.Abs(Math.Cos(2 * n * x) / (Math.Pow(n, 2) * 4 - 1)) > e);
  28. Console.WriteLine("ΠŸΡ€ΠΈ x={0} y={1} SN={2} SE={3}", x, y, SN, SE);
  29. x = x + (x2 - x1) / k;
  30. }
  31. Console.ReadLine();
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement