Advertisement
Ochkasty_Dino

Методы вычислений (маклорен) -сдал, но мне чет не особо нравится

Sep 20th, 2020 (edited)
1,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         public static double q(int n, double x)
  12.         {
  13.             return (-x) / (8 * n * n + 20 * n + 12);
  14.         }
  15.         static void Main(string[] args)
  16.         {
  17.             int n;
  18.             double sum = 0;
  19.             double f ;
  20.             double e = 0.0001;
  21.  
  22.             for (double x = 0.1; x <= 1.7; x += 0.1)
  23.             {
  24.                 n = 0;
  25.                 f = 1;
  26.                 while (Math.Abs(f) >= e)
  27.                 {
  28.                     sum = sum + f;
  29.                     f = f * q(n, x);
  30.                     n++;
  31.  
  32.                 }
  33.                 Console.WriteLine("{0}", sum);
  34.                 sum = 0;
  35.             }
  36.  
  37.             Console.WriteLine("{0}", sum);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement