Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 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 ConsoleApplication8
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             double Fx = 0, fx = 0, X_prev = 0, epsilone_requested = 0.02D, epsilone = 0, X = 0.5D;
  14.            
  15.             do
  16.             {
  17.                 X_prev = X;
  18.                 Fx =  Math.Cos(X) - Math.Pow(X, 3);
  19.                 fx = -Math.Sin(X) - 3 * Math.Pow(X, 2);
  20.                 X -= Fx / fx;
  21.                 epsilone = Math.Abs(X - X_prev);
  22.                 Console.WriteLine("X = {0}\nEpsilone = {1}\n", X, epsilone);
  23.             }
  24.             while (epsilone > epsilone_requested);
  25.             Console.ReadKey();
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement