Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double f(double x) // Функция y(x)
- {
- return (2*exp(3.0 * x - x*x));
- }
- double S(double a, double b) // Поиск интеграла от a до b (Метод прямоугольников)
- {
- int n = 50;
- double s=(f(a)+f(b))/2;
- double h=(b-a)/n;
- for (int i=1; i<=n-1; i++)
- {
- s+=f(a+i*h);
- }
- double I=h*s;
- return I;
- }
- double SS(double a, double b, double E) // Поиск интеграла от a до t
- {
- double t = a;
- double s1 = 0;
- while (fabs(s1 - S(a, b)/2) >= E)
- {
- t = t + E;
- s1 = S(a, t);
- }
- return t;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement