constk

DefiniteIntegral_header

Sep 8th, 2020
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2. #define _CRT_SECURE_NO_WARNINGS
  3.  
  4. #include <cmath>
  5. #include <iostream>
  6. #include <string>
  7. #include <cstring>
  8. #include <cctype>
  9.  
  10. typedef double(*pointFunc)(double);
  11.  
  12. class DefiniteIntegral
  13. {
  14. public:
  15.     DefiniteIntegral(pointFunc f, double leftBorder, double rightBorder);
  16.     DefiniteIntegral(pointFunc f, double leftBorder, double rightBorder, double eps);
  17.  
  18.     double calculate(const char* method);
  19.     int getAmountOfIterations(const char* method);
  20.  
  21. private:
  22.     const double leftBorder;
  23.     const double rightBorder;
  24.     pointFunc f;
  25.     double eps = 0.001;
  26.  
  27.     int calculateAmountOfIterations(double (DefiniteIntegral::*method)(int amountOfIterations));
  28.  
  29.     double leftRecktangleMethod(int amountOfIterations);
  30.     double rightRecktangleMethod(int amountOfIterations);
  31.     double centerRecktangleMethod(int amountOfIterations);
  32.  
  33.     double trapezeMethod(int amountOfIterations);
  34.  
  35.     double simpsonMethod(int amountOfIterations);
  36.  
  37.     double newtonMethod(int amountOfIterations);
  38. };
  39.  
  40. char* toLowerCase(const char*);
  41.  
  42.  
RAW Paste Data