GVA SUPPORT

³äïîâ³äü íà çàïèòàííÿ ¹ 1326803674
Text:
	ԲΠ= Ãîðáà÷åíêî Â.À.

 Çàïèòàííÿ:#include <iostream>
#include <cstdlib>  // òóò rand (), srand ()
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <string>

// ÊÎÍÑÒÀÍÒÈ
#define a 0
#define b 1.8
#define h 0.2
#define MAX_X 9
#define MAX_Y 2

// ÌÀÑÈÂ
double mas[MAX_X][MAX_Y]={ // 10 x 2
       {-0.1              ,-0.985},
       {0.21              ,-0.934},
       {0.63              ,-0.436},
       {0.82              ,-0.0482},
       {0.9               ,0.083},
       {1.29              ,0.962},
       {1.54              ,1.508},
       {1.76              ,1.916},
       {2.13              ,2.336}};
using namespace std;

// =============================================================================


double func_a1(double x){// àïðîêñèìàö³ÿ ïîë³íîì Ëàãðàíæà
       double sum=0; // ñóìà. Âîëêîâ. Ñòîð 32 ôîðìóëà 5

       for (int i = 0 ; i < MAX_X ; i++){
              double z=1;
              for (int j = 0 ; j < MAX_X ; j++)
              {
                  if (i!=j) z*=(x-mas[j][0])/(mas[i][0]-mas[j][0]);
              }
              sum+=z*mas[i][1];
       }
       return sum;
}

// =============================================================================

double func_b(double x){ // ïîõ³äíà 1

        // Öåíòðàëüíàÿ ðàçíîñòíàÿ ïðîèçâîäíàÿ
        return (func_a1(x+h)-func_a1(x-h))/(h*2);
}

//==============================================================================

double func_c(double x){// ïîõ³äíà 2
// ÔÎÐÌÓËÀ | Äðóãà ïîõ³äíà. Êîíñïåêò ëåêö³é 
    return (func_a1(x+h)+func_a1(x-h)-2*func_a1(x)  )/(h*h);

}


//==============================================================================
int main()
{
        cout<<"\tFunction f(x) = cos(2*x)*sin(x)\r\n";
        cout<<"Interval of integration : \r\n";
                cout<<"step of integration dx = \t";
                double dx;
                dx=h;
        double x = a;
        cout<<"integration in process...\r\n";
        double sum = (func_a1(x + dx) - func_a1(x))/2*dx;
        while(x < b)
        {
                sum += (func_a1(x + dx) - func_a1(x))/2*dx;
                x += dx;
        }
        cout<<"complete....\r\n";
        cout<<"result is "<<sum<<"\r\n";
        system("pause");
        return 0;
}
//---------------------------------------------------------------------------


====================================	
Âàøà â³äïîâ³äü